Campaign tracking not working with Matomo Tag Manager

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