TL;DR: If you’re using campaign parameters on internal links get them out. Immediately. And add an annotation noting that you got rid of them.
I’m a huge proponent of campaign tracking for marketing campaigns. But used the wrong way, they can totally trash your Google Analytics data. Like to the point of making the data in your profile completely unusable. And since I’ve run into this in the past six analytics audits I’ve done, I thought I’d aim to raise the level of awareness on this topic.
What Is Campaign Tagging?
If you’re unfamiliar with campaign tagging, check out my comprehensive guide on campaign tagging, where I talk about marketers not taking enough credit for their work. It is beyond critical if you’re doing email marketing. If you’re doing email marketing and you’re not tagging your links, you’re junking up your direct and referral traffic numbers. (Can you say bogo special?)
A Cautionary Tale
But this post isn’t about the efficacies of campaign tagging; it’s a cautionary tale about what can go wrong if you use campaign tagging improperly. Why? Campaign tagging is meant for external links that point back to your site.
Ergo, the best way to trash your data is to use campaign parameters in internal links.
Deep In The Weeds
The reason for this is when you tag a link with campaign parameters using Google’s URL Builder or my Google Doc that enables you to just paste a list of URLs and have the parameters added automatically (wooOOoop!), you are reassigning the source and medium data. So let’s say you tagged a link to look something like this:
And someone clicks on this link from from hootsuite.com. Because I assigned the source to be twitter.com (via utm_source=twitter.com), that referral source will now show up as twitter.com, not hootsuite.com. And instead of the visit showing up as a referral, it will show up as social because I assigned the medium to social (via utm_medium=social).
You following me?
So what I’ve seen sites do is add campaign parameters to their navbar and footer links or even internal banners. The problem with this is let’s say you have a navigation link tagged, and it looks something like this:
http://www.yoursite.com/about/?utm_medium=top+navbar&utm_source=homepage&utm_campaign=nonsense
Now let’s say someone comes to your site via Pinterest and then clicks this tagged link to get to your about page. That visitor no longer shows up as coming from Pinterest. Your referral is your own site.
Worst Case Scenario
In auditing a company’s Google Analytics profile this week (a service I offer), they had 1.4 million sessions in the past month that had been reassigned. My heart stopped. I’ve seen campaign tagging cause shenanigans in data but never anything this pandemic. It was the first time I had to tell someone that their analytics data is completely useless. As in they can’t use their analytics data to measure any of their marketing efforts — organic, paid search, campaigns — nothing. Because they had tagged links in their navigation and all through the site, those reassigned visits were just too pervasive.
So if you’ve been using campaign tagging on internal links you need to see what percentage of your visits have been reassigned. If it’s a significant amount of data, I would recommend consulting with an experience analyst to make sure your data is trustworthy at all. Here are a couple preliminary checks I use to check for evidence of tagging internal links.
Learn More
If you want to see if you’ve been tagging your campaigns correctly, and how the rest of your Google Analytics is doing, check out my DIY Analytics Audit Template.
You can also check out my Definitive Guide to Campaign Tagging in Google Analytics for a more in-depth look at how you should be tagging your campaigns.
Molly says
Thanks Annie! This has been SO helpful 🙂
Annie Cushing says
My pleasure, Molly!
Joe L says
Hi Annie. I’m in the middle of a site consolidation, bringing dozens of blogs from external domains into my primary domain (e.g. blog1.com and blog2.com are becoming primarydomain.com/blog1, etc). The problem is that the authors have been using campaign tags on links to point to primarydomain.com for years – literally thousands of posts. And many links are wrapped in a shortener, so we can’t even do a find/replace during content migration.
I’ve been trying to figure out some way in GTM or GA to “ignore” the campaign tags if the referrer is primarydomain.com, but haven’t figured it out yet.
Have you ever had such a problem, and were you able to solve it?
Annie Cushing says
So I threw this question out on Twitter and got a bunch of options for you to consider. One friend, a developer at Google, even wrote custom code for you. https://twitter.com/AnnieCushing/status/806518054368739329
Annie Cushing says
Here’s a link to the custom code tweet: https://twitter.com/iamchrisle/status/806527934844444672.
Joe L says
Ho. Ly. Cow!!!! Annie, this is amazing! Using your network to help me out is truly going above and beyond for your readers. Thank you so much!
Annie Cushing says
My pleasure, Joe! They’re a smart bunch of guys! (And the conversation is still going.)
Annie Cushing says
So my friend, Simo Ahava (a total badass developer), followed up with an email with further instruction and clarification:
So, from what I understand the user has lots of links pointing to pages in primarydomain.com, but these links have UTM parameters, and are shortlinks so you can’t just run a find-and-replace?
In that case, here are top-off-my-head alternatives:
1) Develop a crawler (or perhaps leverage something like Screaming Frog) that goes through all these shortlinks and resolves them. If the shortlinks resolve to primarydomain.com?utm_something, then rewrite them in the page templates to proper, UTM-less links. This is naturally quite a big development undertaking, though if the client uses some existing framework such as WordPress, it might be not be too cumbersome. This would definitely be the solution for the long run, as it would strip UTMs in the page template level, so you won’t require redirects or JavaScript hacks.
2) Server-side redirects. For every request to primarydomain.com, if the referrer is primarydomain.com AND the request URI has ?utm_something, redirect (301) the user to an UTM-less version of the URL. This is should be quite simple to do, depending on the web server software used. With Apache, for example, I think it could be done in .htaccess quite easily.
3) JavaScript fixes. There are some of these. One is to use GTM on primarydomain.com, and if the referrer is primarydomain.com and the URL has ?utm_something, then modify the “page” field in all GA tags to not include any UTM parameters. This is fairly simple to do but unfortunately requires you to keep every single GA tag up-to-date with the change. If even a single tag slips through the cracks then BAM! It’s a broken session.
Another JavaScript fix would be to create a fake history entry. If the referrer is primarydomain.com and the URL has ?utm_something, then use window.history.replaceState() to replace the current URL with UTM-less URL. This is fairly clean, doesn’t require modding your GA tags at all, but the downside is that it needs to run before GTM has time to start up, so it might require developers to add the hack to the page template. Also, IE from 9 and older do not support the window history API.
So there you go … an early holiday present!
Joe L says
Annie, you and your friends are unbelievable! I’m probably personally responsible for about 5% of the pageviews on Simo’s blog, so I know his insights are top notch. To get personalized recommendations from him, Chris, etc… it really is an early holiday present. Thank you so much!!!
Annie Cushing says
Happy to leverage my network of geniuses to help, Joe!