A Practical Guide For Tracking Short URLs With Google Analytics
How To Make Vanity URLs That Include UTMs Or Redirect To Longer URLs
Most of the time in Digital Marketing it’s easy to hide ugly and/or long URLs behind a nice looking link text. However, what about offline media (like print) or in Digital Channels, like Facebook, that don’t offer the ability to have link text and a link URL?
In this article HammaJack co-founder, Jacob Moran, will outline some of the options for simplifying and beautifying URLs while still getting users to the page they need to go to and tracking where they came from.
Why do we need all the information at the end of a URL?
Firstly, before we begin if UTMs are are a foreign concept or you want to brush up on them see here for a handy non-technical guide.
Now, there are two distinct reasons we would want to shorten a URL.
The page URL that we need to link is too long (too far down in page structure), i.e https://hammajack.com.au/product-and-services/search-engine-optimisation-seo
The marketing campaign pointing at the URL needs to be tracked and therefore has UTMs (which make the URL too long and ugly) i.e. https://www.hammajack.com.au?utm_source=Article&utm_medium=Website&utm_campaign=Client_Engagement&utm_content=Example_UTM
Either way, as you can see, the length of the URL would completely ruin the aesthetic of your otherwise pretty ad and make it really annoying for users to type out.
So what can be done to make this URL/UTM more appealing without losing the needed information to correctly track and attribute value to the campaign? Well, that’s where vanity/short URLs can help.
What are Vanity URLs/Short URLs?
Vanity or Short URLs are the process of making long URLs shorter and then, when the user types the URL into a browser or clicks on a link, redirecting them to the actual URL.
Vanity URLs themselves are not actually pages, they are merely a URL that is used to tell the browser to redirect to another URL (i.e. the one with the actual information).
Vanity URLs allow you to put something like “https://www.hammajack.com.au/vanity” and then, through the options we will go through below, turn it into “https://www.hammajack.com.au/vanity?utm_source=Article&utm_medium=Website&utm_campaign=Client_Engagement&utm_content=Example_UTM”.
As a complete aside - if a competitor of yours is using an unbranded Bitly or Google links you can use a nice little hack to see the stats on how they are performing.
For Bitly links, you can simply add a plus symbol to the end of the URL
For Google links, you add .info to the end of the URL
Now there’s no need for vanity URLs if you are in a digital environment and you have the ability to have a link with shown text and then an underlying link such as the below example;
This link here is an example of a link with text and then an underlying link. In this example the link text that is shown is “link here”, but when you click on that link you go to “https://hammajack.com.au/get-digital/easy-content-strategy-for-your-business”
If the above scenario describes you, then you can just add your UTM and post your ad.
However, if this isn’t an option for you, or if your in a non-digital environment, you have a few options.
Tracking Specific Landing Pages with UTMs using GTM
Before we plough in, the examples below are using Google Tag Manager. If you don’t have Google Tag Manager, you should really get it as it makes all of these things much easier.
If you have a campaign-specific landing page that you want to send people the process is fairly straightforward.
For the purposes of the below a ‘campaign-specific landing page’ is a landing page that is only being actively pushed to by one campaign at a time and is not linked to anywhere else (even on the website).
Let’s say you have a landing page called https://www.hammajack.com.au/vanity and you wanted to tell Google Analytics more about that campaign. To do this we do not need to make any changes to the website. How cool is that? We can make these changes directly in GTM.
To do this your going to make 2 changes in GTM;
Create a variable to change the page URL that GTM sends to Google Analytics
Edit your Google Analytics Tag
Create the Variable
Firstly, in the variables section of Google Tag Manager create a new “RegEx Table” variable and call it something like “Vanity URL Checker” and fill it out as follows;
Make the input variable “Page URL”
Create a row and, using Regex identify the string (in this case .*vanity.* will be fine) as the Input Pattern
Enter your longer - full - URL as the Output (in this case, “https://www.hammajack.com.au/vanity?utm_source=Vanity_URL&utm_medium=Article&utm_campaign=Client_Engagement&utm_content=Vanity_URL_Example”)
Set the Default Value as “Page URL” - this is super important
It should end up looking like the below;
Edit your Google Analytics Tag in GTM
Next, head over to your Universal Google Analytics Page Tag in GTM.
Please note that the below using the GA template tag, however you could do it with the custom HTML version as well.
In the tag do the following;
Tick “Enable overriding settings in this tag”
Open “Fields to Set” and then select the “location” field
Set the Value as the variable you just created (in this case “Vanity URL Checker”)
It should look like the below;
To test your tags you can use any number of tools - see here for a list - but basically you want to make sure the location is changed to the required field.
You can then save the tag and preview/publish the container.
Basically what we have enabled our GA tag to do is, when the tag fires it looks to see if the Page URL that it has fired on is in the Vanity URL Checker list, and, if it is, it changes the Page URL that it sends Google Analytics (or anywhere else we want to send it) to match the output BUT if it doesn’t match, it passes through the Page URL as it is.
Tracking Generic Landing Pages with UTMs
Tracking generic landing pages is slightly more complicated than specific landing pages but it still follows a similar process.
Let’s say you have a generic landing page called https://hammajack.com.au/work-with-us/ that you use for multiple campaigns and/or is a standard page on your website that gets traffic from a variety of sources. However you still want to tell Google Analytics that the visits to this page are because of a campaign you are doing so that you can separate it from the other traffic to this page.
As alluded to before, if you have the ability to link text and an underlying link then you can just add your UTM and post your ad. However if this isn’t an option we need to use a vanity URL with a redirect. This requires access to the website backend.
The key is here is that you need to create a unique vanity URL that is specific for this campaign. Let’s say the campaign is for a Spring Sale, a vanity URL for this could be https://hammajack.com.au/spring.
Once the vanity URL is picked and you’ve configured your UTM on the original link, the process differs depending on which CMS (like Wix or WordPress) you are using. But the basic process is to find out how they handle redirects and then do a 301 redirect from the vanity URL to the generic URL with the UTM attached.
For the above example this would look like below;
Output: “/work-with-us?utm_source=Vanity_URL&utm_medium=Article&utm_campaign=Client_Engagement&utm_content=Vanity_URL_Example” (or whatever your UTM is)
Most Important Point
Your URLs, whether they’re included in digital or traditional media, need to be trackable but they can still be on brand by using Short URLs and redirects.