Search code examples
google-analyticsanalyticsutm

link with utm not tracked due to language being added to link


my client is sending a link to costumers across 3 countries with utm to track on google analytics. these links are send through linkedin, fb, twitter etc. something like this:

https://wwww.example.com/page?utm_source=linkedin_stem&utm_medium=cpc&utm_campaign=lk_stem_tkt https://www.example.com/page?utm_source=facebook_stem&utm_medium=cpc&utm_campaign=fb_stem_tkt

however these links are not being tracked on analytics, i believe due to the language prefix being added as you enter the website, like this:

https://www.example.com/en/page https://www.exemple.com/es/page https://www.example.com/pt-pt/page

is there a way to track this utm's without mentioning the language prefix?


Solution

  • Analytics parses query parameters. It doesn't care about the path itself. However, in your examples with lang set, the utm params are missing.

    So what I believe your issue is, is a trivial redirection from a url where the language is not set to a url where it's set. During the redirection, you lose your utm-params.

    Most likely, the redirection kicks in before GTM has a chance to fire a pageview (utm-params have to be set just on one hit in a session), thus, the attribution is lost completely.

    Now the best fix for it would be changing the redirection rule to pass query parameters to the destination url. It should be a trivial task for whoever set up the redirection in the first place. Presuming the redirection is backend-driven. There may be other fixes for GTM, but they are out of scope.