*Editor’s Note: A Smarter Way to Track Campaigns in Google Analytics (+ Free URL Builder) was updated May 2018
How do we track a campaign’s performance?
We can track how many people click a link to visit our blog, but do you know where they came from, if they visited a specific landing page, if they found our blog from a specific Google Search, if your email campaign worked better than your Facebook ads campaign, or if you generated any revenue for those campaigns.
Fortunately, this information is relatively easy to track using Google Analytics, but what isn’t easy is trying to track performance for a client that has an awful event tracking setup.
Since tracking mistakes are a fairly common issue (and I’ve, admittedly, made a few myself), I’ll teach you how to fix your tracking mess, explain the shortcomings of using a pre-built URL Builder tool, and walk you through how to create your own URL builder with a free downloadable template (see below)!
In this blog post, I’ll cover:
The GIGO Effect: What it is, and How It’s Damaging Your URL Tracking
You get out exactly what you put into your website tracking.
Garbage in, Garbage out.
We’ll get further into this later, but whatever you put in your tracking URL is what shows up in the analytics software you use.
If you don’t use good naming conventions, aren’t tracking useful variables, or (worse) aren’t consistently applying tracking, you’ll have no way to know if your campaigns are working.
If your event tracking is a mess, you don’t have good data. If you don’t have good data, you can’t know how to improve performance.
UTM Codes: What They Are and How to Use Them
Note: I’ll use Google Analytics in all my examples, but the same (or similar) concepts apply to all analytics platforms; Mixpanel, Omniture, KISSMetrics, etc. Make sure you ask your vendor how tracking with your platform differs from Google Analytics.
When you open Google Analytics (assuming you have it already set up), you can already see what websites sent you traffic. In this example, I see that Facebook is sending us a lot of referral traffic, so let’s dig deeper and see what campaigns are working well for us.
No campaign information.
Well, it’s still not too much of a problem at this stage; even if you can’t tell which Facebook post worked the best, you can at least tell how your efforts on Facebook are doing in general.
Now, say you wanted to spend some money promoting a post. How would you tell whether that spend was worthwhile?
What Are UTM Codes?
Urchin Traffic Monitors (UTM) codes are small bits of text you can attach to a custom URL to track the effectiveness of your marketing campaigns from various sources, mediums, and platforms.
If, for instance, I want to track the performance of my email marketing campaign, I can use UTM campaign parameters to look up that campaign in Google Analytics and see how much traffic and how many conversions that campaign drove.
You should be familiar with the five UTM parameters:
- Source (utm_source): The parameter defines the referrer (e.g. Google, Facebook, Email newsletter, etc. )
- Medium (utm_medium): This parameter defines the marketing channel the traffic is coming from (e.g. Social, Search, Email, etc.)
- Campaign (utm_campaign): This parameter defines the marketing campaign (e.g. Product launch, Sweepstakes, etc.)
- Term (utm_term): This optional parameter defines the search term or audience for your paid ad campaigns (e.g. Cheap flights, Friends of fans, etc.)
- Content (utm_content): This optional parameter defines the ad format (e.g. Promoted post, Banner 300×250, Text ad, etc.)
Here’s what UTM parameters look like when added to a website’s URL:
Pro Tips for Building URLs with UTM Code
There are a couple of rules to remember must remember regarding URLs:
- In the URL, you must place one question mark immediately after the original website URL, and every additional parameter after the first must be joined with an ampersand (&).
- Source, medium, and campaign must all be present for it to be recorded by Google.
- All special characters must be encoded (e.g. “20%Off25_Sale” rather than “save 50%”)
- Keep your URL under 255 characters or some of the values may get cut off. Of course, a really long URL is off-putting and eats into your character limits when posting on social. So it’s very common for people to shorten the link using a service like Bit.ly.
Note: social media management tools like Buffer can add utm_ parameters and shorten the links for you automatically.
How Link Tracking Works on Mobile
Mobile is different.
In fact, it’s a completely different ball game. Though utm_ parameters do work for Android apps (with a slight modification), the Apple app store won’t let your utm_ parameters pass through!
There are a number of different mobile-friendly tools which solve this ‘link attribution’ problem, but we mostly use Branch.io or AppsFlyer. Though the setup is complicated, it works in a really similar way:
You’ll grab a link just like a Bit.ly link from whatever platform you use and enter that where the URL would normally go.
Once someone clicks the link, the Branch.io or AppsFlyer records information about the user, then redirects them to the app store. Once they install and open the app, it does a reverse lookup to see what link they clicked and attributes that install to the right campaign.
With additional setup, you can often then push that information into your analytics platform (for example Localytics or Mixpanel) and/or land a user on the right deep link page; for example, if you’re promoting a specific page within the app, i.e. a Paris hotel deal.
What UTM Parameters Should I Use?
So far so good? Now, this is where it gets tricky.
Just because you can put whatever you want in these parameters, it doesn’t mean you should. Remember ‘Garbage In, Garbage Out’?
Because there’s no way to overwrite Google Analytics data, using the wrong campaign parameters can get you into trouble when you try to do analysis on your data.
For example, check out these source/mediums from a real client of ours:
What a mess!
If you wanted to do analysis on the value of Facebook traffic, where would you start?
Here are just some of the issues could face:
- If you filtered for “social_media”, you’d miss “socialmedia” and “social+media” traffic
- Traffic for “Facebook” and “facebook” won’t be aggregated together in source reports
- What in the World do “Facebook / Twitter” and “Facebook / Insta” mean?
- With so much referral traffic, are we sure these aren’t un-tagged ad campaigns?
- Don’t forget to include the “Boosted_Post” when looking at paid ads performance
It should be obvious at this point that sticking to consistent naming conventions is the key to getting the most out of your parameters.
So that’s what we’ll cover next.
The Ultimate Rulebook for URL Building and Link Tracking
Now that we’ve seen how much of a pain it can be to get this wrong, let’s go over a few sensible principles for getting tracking right.
Rule #1: Consistent naming
Keep track of the names you use to refer to each channel, and don’t deviate.
I.e. ‘ppc’, ‘cpc’ and ‘google-ads’
Rule #2: Consistent capitalization
Decide on how you will capitalize and stick to it. My preference is all lower case.
I.e. ‘Facebook’, ‘facebook’ and ‘FACEBOOK’
Rule #3: DRY (Don’t Repeat Yourself)
Don’t repeat the same information in multiple utm_ parameters, it’s a waste of space.
Rule #4: Plan ahead
Make sure the variable you plan to report on, is in your utm_ parameters.
I.e. ‘utm_campaign=image-a’ vs ‘utm_campaign=image-b’
Rule #5: Use unique IDs
If you use a unique ID in your utm_ parameters you can look up information about it later.
I.e. ‘utm_campaign=test1a’; with all the details of test1a stored in a google doc
Rule #6: Mark your paid campaigns
Make sure all ‘paid’ advertising or marketing campaigns are denoted in the parameters.
I.e. ‘utm_medium=cpc’ or ‘utm_source=facebook-ads’ or ‘utm_campaign=$test1a’
Rule #7: Use Dashes for spaces
You can also use colons (:), pluses (+) or pipes (|) or underscores (_), but dashes are best.
Rule #8: Keep It Simple
Don’t start with complex rules you’ll never stick to. Start simple and slowly build on it.
I.e. ‘utm_campaign=T93-a45-c88-m42-pDT-cpc-US-20160922’ is probably too much at the start
Rule #9: Avoid embarrassment
Remember that users can see whatever you put in your parameters. Don’t embarrass yourself.
Rule #10: Aggregate concepts
Think about what aggregate data would be interesting to see; add them to your parameters.
I.e. use ‘utm_medium=social’ across Twitter, Facebook & Pinterest to report on all social traffic.
How to Build Your Own URL Builder
Great – so how do you take those concepts and put them into practice?
It’s time to build a URL builder!
First, let’s take a look at Google‘s URL Builder:
This tool is definitely useful, particularly for beginners.
…but there’s a problem. Well, 3 problems actually:
- You can’t save your old links
- You can’t ensure consistent naming
- You have to do one at a time
So I’m going to teach you how to build your own, for free.
Step 1) Create your Google doc
The collaborative features of Google spreadsheets make it the obvious choice for an important document like a URL builder. You can share with multiple people, who can all edit in real time and you can roll back changes if something goes wrong. Can’t beat it.
Pro Tip: If you’re not particularly savvy with Excel / Google Docs, check out the Excel tutorial I made for all our new marketing hires at Ladder.
Step 2) Add column headers
We can develop on this further, but for now, we just need the landing page (Base URL), Source, Medium and Campaign (UTM parameters) and a place for the output (Tracked URL).
Step 3) Fill in a few examples
Add a wide variety of examples so you can develop a good naming convention in line with the principles we discussed previously. In this example, I have a few paid search campaigns (cpc), a few paid social campaigns (cpm) and a number of links I post on social media.
With these parameters, I’ll be able to answer the following questions within Google Analytics:
- How much traffic did I get from paid campaigns? (cpc + cpm)
- How is paid social doing vs paid search? (cpc / cpm)
- What’s driving performance on Facebook? (lookalikes / retargeting / posting)
- For which channel should I increase budget? (facebook cpm / twitter cpm / google cpc)
- Is it worth posting every day on social media? (posting)
- What blog post drove the most traffic when posted on social? (url + posting)
Step 4) Concatenate the URL
The next step is to concatenate the URL, which is just a fancy way of saying combining all of your UTM elements together.
If you’re up for a little challenge, here’s the formul you need to do it manually: (copy-paste it into your own spreadsheet):
This may look complicated, but it’s not too difficult once you get used to it (check out our Excel tutorial if you’re struggling).
All it’s doing is adding (or concatenating) the cell values together with the right UTM parameters, to build the URL.
Drag this formula down and you have your very own URL builder!
You can add new rows to the bottom as you get new campaigns, and just drag the formula down to update it and get your links.
If you need a little help getting started, download the exact Google Sheet I created and use it as a template.
Step 5) Add validation checks
Now, you’ve already got a version that works better than Google’s tool. It saves our old links in a collaborative file we can share with our team.
But how do we solve the other problem, ensuring people follow the right naming conventions?
That’s where validation comes in.
First, create a new tab with all the valid entries you want to allow–in this example, I’ve just decided to lock down Source and Medium.
Next, select the column in your main sheet, and go to Data > Validation.
From there, you can enter in the Criteria row (the column in the ‘valid’ sheet) and voila! Entering anything other than a correct value will cause an error.
Step 6) Add filter, static header
As your list grows, you’ll find yourself endlessly scrolling, and getting lost in the sheet. To make it a little more useable, filter the table (above) and freeze the top row (below). Now you can sort or filter the sheet, and scroll down without getting lost.
Step 7) Add more variables
As you start to run more marketing experiments, you’ll probably outgrow this simplistic spreadsheet and you’ll want to track more variables. Here’s how:
First, insert more columns for your new variables. In this case, I want to track the audience, creative, and the messaging used. Then fill out the values, as before.
Now it’s just the case of updating the concatenation formula, and you’re set. Here’s what that looks like:
Step 8) Create a variable key
All these additional variables aren’t doing us any good if we don’t know what they mean. Now, it’s time to create a ‘key’ where we can write explanations for what each ID refers to.
I’d opt to keep this relatively uncomplicated and link out to other more detailed Google docs if the client/your boss/your team needs more detail.
Of course, you could keep going from here: you could add more variables, make a column for the encoded URL, and add a column for the Bit.ly link.
You could manage your workflow from this document; add a checkbox for when the team has put the new URL live. You could even add reporting; fill in performance data by utm_ parameter.
I’d also recommend you institute regular audits of this document and how well it matches your campaigns; pay a cheap freelancer every month to go through your campaigns line by line and check the URL is a) not broken and b) it matches what’s in the document.
So I think you get the idea; the sky is the limit when it comes to making this URL builder more useful, but with just a few minutes (and zero cost) you could have a working builder that solves all the horrendous tracking problems most people suffer with. Again, if you need help getting started, click the button below to download my free URL builder template.
Advanced Troubleshooting Tricks for URL Tracking
Because highly technical issues come up surprisingly frequently, I wanted to reference them briefly here and point to potential solutions.
Case #1: Self-referrals
If you look at your source/medium report and see traffic coming from your own site or a third party payment site like PayPal, you’ve got a problem. Your traffic will lose its original marketing source (facebook, google) and instead your sales will be attributed to your own domain or a third party payment system (PayPal). There are more technical fixes, but luckily the problem is easily solved by just excluding the offending domain in Google Analytics.
Case #2: UTM sharing
If you’re really savvy, you’ll notice the UTM system isn’t perfect; what happens if I come through a Google Adwords campaign, but then I share my URL with you (complete with utm_ parameters)? Google will attribute your conversions back to the original campaign I clicked on. This issue can be solved by wiping the referral information once you’re done with it.
Case #3: Conditional content
Want an easy way to personalize a landing page? Use utm_ parameters to conditionally change content on the page for visitors from specific marketing campaigns. For example, trigger a customized SumoMe welcome mat or smart bar only for visitors from a specific site. You can do the same thing with Optimizely experiments (pro tip: to make temporary personalized changes on your site, just set the ‘test’ to 100% of that specific audience). Unbounce dynamic text is another great example of this.
Case #4: Hidden form fields
Need to tie your marketing campaigns back to the specific leads that came in? Or simply can’t get your boss/client to log into Google Analytics? Use hidden form fields in Unbounce to record the utm_ parameters right alongside the lead’s email address in the database. Something about seeing those leads right alongside their marketing source makes the whole system more trustworthy, particularly for non-technical people. From Unbounce you can push that information into any other CRM, but if you want an implementation that works on your own website, try something like this custom solution. It will take some development work, but the flexibility to be able to use your own attribution rules and being 100% confident in the data can be priceless.
Case #5: Spreadsheet scripts