Campaign tracking not working with Matomo Tag Manager

I have matomo on premise setup with the matomo tag manager. It is all working apart from campaign URL’s. Do I have to install the javascript (_paq) code as well as the mtm tag manager code in the website? Or is there something I should setup in the tag manager to get campaign tracking working.

TIA
Adrian

1 Like

So I found the problem. I had followed the setup here https://matomo.org/faq/how-to/faq_23636/ because it is mostly a SPA page

Setting the custom URL to {{PageOrigin}}/{{PageHash}} broke it because it strips off the query string. (Obvious to me now :wink: )

To fix it - I created a new custom variable in the tag manager called QueryParams as type “URL Variable” and set the URL part to “Search Query”

I then changed the Custom URL potion of my Tag for the page views to {{PageOrigin}}{{PagePath}}{{PageHash}}?{{QueryParams}}

And now it sends the campaign query params along.

2 Likes