abbie
abbie

Reputation: 65

How to prevent WordPress theme from removing analytics tracking parameters

I'm trying to track page views in google analytics using utm parameters, but they're getting stripped out of my urls when loaded. The problem appears to be specific to the WordPress theme I'm using, but I haven't been able to locate any code in the theme files that would cause this behavior.

I'm using a child theme, but the behavior is present in the parent theme and can publicly be seen here: http://coolist.themewaves.com/food/2016/10/31/consequat-ipsum-sagittis-sem-nibh-elit-duis-sed-odio-amet/?utm_source=sourceexample&utm_medium=facebook

Everything I add after "?" is ignored, which prevents me from tracking traffic. Locally, I've disabled all plugins but the behavior persists. However, if I switch to a completely new theme the tracking links do work, so I don't believe it to be a configuration issue. (My .htaccess file is the standard basic file w/o any modifications).

I've been searching the code base for any functions that could cause redirects or otherwise modify the url (e.g. remove_query_arg, anything with the word "redirect") but no luck so far.

Does anyone have suggestions for things to try or potential causes? Any input would be greatly appreciated, many thanks!

Upvotes: 1

Views: 1362

Answers (1)

AnkDasCo
AnkDasCo

Reputation: 1599

Given the link, I can see that there is problem with your header image scroll.

It removes the parameters after you scroll through the header image. But that is ok because UTM parameters are meant for landing pages and not for subsequent pages. GA automatically attributes the utm parameters to the session once the user lands on the landing page, even if it is removed in subsequent interactions. Hope this makes sens

PS - If the given link is a testing URL then I couldn't find the GA code

Upvotes: 2

Related Questions