How to add Custom Dimensions to UTMs
Setting Google Analytics Custom Dimensions through a URL
UTMs are an amazing source of information for Google Analytics, but sometimes you need more. In this article HammaJack co-founder, Jacob Moran, outlines how to set Custom Dimensions in Google Analytics using UTMs and Google Tag Manager.
So, let’s say that you have a site that has different Personas. You want to know how these Personas use your site, as well as their propensity to convert. As part of your Digital Strategy, you are doing a lot of Digital Marketing to try and drive more people to the site. This Digital Marketing focuses on each of your Personas, so you want to tag your marketing campaigns by Persona and pass this information through to Google Analytics. This could look something like the following;
Facebook Ad targets a “Hardcore Driver” Persona
A user clicks the ad and is taken to the site
The user sees some content and signs up to the newsletter
Now through the beauty of UTMs, you know that this user came from a paid ad on Facebook, but you also want to know that they were a Hardcore Driver. How can you do this?
While you could use one of the standard UTM fields (such as utm_term or utm_content), the best bet is to use a custom UTM string that links to a Custom Dimension.
If you aren’t sure what UTMs are, I recommend reading our non-technical guide to UTMs before continuing.
How to set a Custom Dimension with Google Tag Manager and UTMs
Now there are three parts to this;
Giving the UTM to the site
Scraping the UTM with GTM
Sending it to Google Analytics.
Setting the UTM
Setting the UTM is fairly straightforward but does require some knowledge of UTMs.
First things first, UTMs aren’t exclusive to Google Analytics. UTMs are just query strings that Google Analytics has been conditioned to understand. Query strings are used all across the web, for a variety of reasons, but the basic idea is that a query string allows a website (or browser) to get more information than just the URL, which it can then take and use for some purpose.
Knowing this, it hopefully makes sense that you do not need to stick to the standard UTMs when providing information to Google Analytics (or any other system). You can provide whatever information you want.
For example, some use cases of what query strings (UTMs) can include are;
The weather when the UTM was generated
A user’s level of subscription
A user’s choice of product or package
With Personas, all that a marketer needs to do is set a query string variable of utm_persona on the URL and then ask the Data Engineer to pick it up.
This could look like the following;
If the above looks too ugly you could always shorten your URLs with short URLs.
A few tips for creating the UTM;
Ensure the naming convention makes sense
Ensure the naming convention is scalable
Make sure you use “_” instead of spaces
Be careful with Upper vs. Lowercase as any difference will matter
Scraping the UTM from URL with Google Tag Manager
The next step is scraping the query string using GTM.
To do this, all you need to do is create a User-Defined Variable in GTM that defines the UTM value, which matches utm_ persona.
Once this is done, if you preview your container (with the UTM) you should see the variable being declared.
Declare the Persona Custom Dimension in Google Analytics
Next you need to prepare Google Analytics to accept the information. To do this, you need to create the Custom Dimension in Google Analytics.
Sending the Custom Dimension Value to Google Analytics
Once the persona has been declared in GA and GTM, you just need to update your Google Analytics page tag to send the information as a Custom Dimension. To do this, go to your Google Analytics pageview tag in GTM and set the corresponding Custom Dimension to the variable that you set up in GTM earlier.
Once this is done, publish it and then you should see it being sent to Google Analytics.
After this you should see the data coming through into you Google Analytics reporting. This can take up to an hour in some cases (as it doesn’t turn up in the real-time reporting).
Most important point
Whilst UTMs alone provide valuable information to Google Analytics, inserting a custom dimension that defines your target Persona allows you to learn even more about them. By learning which Personas are engaging with your ads, you’ll be much more effective with your Digital Marketing and will be able to send the right message to the right audience.