Did you know that you can track the audience’s movements with the help of the URL they use to access your website?
The URL has a string attached to it which contains various UTM parameters that can track and send information to the servers.
In this guide, we’ll learn to create our own custom UTM parameters via Google Tag Manager and send the information across to the Google Analytics account to analyze it.
If you’re new to Google Tag Manager, we’d suggest going over our handy GTM tutorial for beginners first.
An overview of what we’ll cover:
So, let’s start!
What are UTM Parameters?
UTM Parameters are encoded messages that are added to the URL of the user in the form of query strings.
These parameters are readable by the search engines and sent over to our analytics accounts. They can help us in tracking the user activity on our web pages and analyze that data.
Let’s learn more about what they can do!
In this guide, you’ll learn to create a custom UTM parameter.
This means we’ll create parameters other than the existing standard Google Analytics campaign parameters.
We have created a demo newsletter for mailing our audiences.
Each different link provides a different discount rate.
The URL parameters of these links are readable by Google Analytics. They further transfer this data into the campaigns.
You can also track the exact source of the traffic from your campaign data in the Google Analytics account.
You’ll need to navigate to Acquisition → Campaigns → All Campaigns. You’ll find all your active campaigns in this section.
You can use various parameters including the keyword or also the Source/Medium campaigns.
For this campaign, we have used the Google Analytics Campaign URL Builder tool to create the URL.
You’ll need to fill out the required fields: Website URL, Campaign Source, Campaign Medium, and Campaign Name.
In addition to that, you can also add the Campaign Term and the Campaign Content to the URL.
Which Three Campaign Parameters Are Recommended to Manually Track Campaigns?
The three recommended campaign parameters to manually track campaigns are Campaign Source, Campaign Medium, and Campaign Name.
The campaign source parameter allows you to track the source from which the user accessed your website.
The campaign medium allows you to track the medium that the user used to access your website.
Lastly, the campaign name gives you information about the particular campaign that enables the user to access your website.
Which Tags Are Standard Google Analytics Campaign Parameters?
There are three standard Google Analytics campaign parameters, utm_source, utm_medium, and utm_content.
As the name suggests, these parameters are used to track the source of the user, the medium user used for accessing our website, and the content that the user accessed on our platform.
However, in this guide, we’ll learn to create a new parameter to track the user activity on our website manually.
🚨 Note: If you want to know your traffic’s initial source before landing on your website, you can find it out with GTM.
This happens when you have already exhausted all the parameters and still need a custom parameter to track any particular user movements on your webpage.
We can create such custom parameters with the help of Google Tag Manager, and forward this data to Google Analytics account, so we can analyze it.
Let’s see how!
How to Create Your Own UTM Parameter
Let’s take the example of the URL links we added to our newsletter.
We have different discounts on the basis of different links in the newsletter.
Unfortunately, no such parameter is available in the URL builder that can give us custom discounts based on the URL.
This is where we need to create our own UTM parameter.
Let’s say we add our own parameter of discount=90.
Refresh the page and see if Google Analytics picks up the data.
Unfortunately, Google Analytics can’t interpret the parameter as it is going beyond the set of the parameters defined to it.
We’ll learn to create a new UTM parameter, and send this data to Google Analytics so it can interpret and understand the data.
We already have the value of 90 for the keyword discount.
We already have a Tag for PageView. We’ll need to create a new custom variable to make this data available for Google Analytics to read.
Let’s see how!
Building a New Custom Variable in Google Tag Manager
Click on New from the Variables section.
We’ll choose the Variable Type as URL. Our Component Type will be Query.
We’ll use the Query Key of discount. The query key is the keyword we use before the equal sign on the query string.
You can understand how to use query strings and parameters before setting up custom parameters.
Once done, we’ll add a Name to the variable, and click on Save.
We’ll refresh our preview and debug mode, as well as refresh the website to see how the variable works.
We’ll check the Variables section for the PageView event.
We can see that the url – discount holds the value of 90.
Let’s also check whether this value is dynamic. We’ll add a discount value of 50 in the URL this time instead of 90, and reload the page to see the results.
We can see that as the page loaded, the value of 90 changed to 50.
Once we have captured this information into the variables, we’ll send this to Google Analytics by using a custom dimension.
On your Google Analytics account, navigate to Secondary dimensions, you’ll find all your Custom Dimensions here.
Let’s learn how to configure them!
Open the Admin Settings and navigate to Custom Definitions → Custom Dimensions → New Custom Dimension.
We’ll add a Name to the dimension, and use the Scope as Session because our UTM parameters are also scoped to sessions.
We’ll keep the status as Active only.
Once done, let’s click on Create.
Next, we’ll need the dimension value of the dimension we just created. In our case, the value is 3.
Let’s now configure this into Google Tag Manager!
We’ll need to build the custom dimension into the PageView Tag in the Google Tag Manager account.
On the Tag, click on Enable overriding settings in this tag.
Then open More Settings → Custom Dimensions.
Here, we’ll need to add the Index and Dimension Value of the new dimension by clicking on Add Custom Dimension.
The Index number will be 3 in our case, and choose the Dimension Value as url – discount. This means dimension number 3 will be filled with the URL discount as its value.
Once done, click on Save.
This is how we added a dimension to one Tag. However, we can also add it to all the Tags by directly adding the dimension to the Google Analytics Settings variable.
This is the recommended method.
Google Analytics Settings Variable
Let’s open our Google Analytics Settings Variable.
We’ll again navigate to More Settings → Custom Dimensions → Add Custom Dimension.
The Index number is 3 in our case, and choose the Dimension Value as url – discount.
We’ll Save it once done.
Let’s refresh the website and also the page from the preview and debug mode.
We can see that the Tag has fired correctly. Let’s check the Tag details in the Google Tag Assistant.
In the Pageview section, we’ll open the Custom Metrics. We can see that the custom dimension of 3 was fired, with a value of 50.
Let’s now learn to analyze these results from the Google Analytics account.
We’ll open Acquisition → All Traffic → Source/Medium.
You can see the newsletter/email source mentioned.
We can open the Secondary dimension and search for discount, and click on it.
Once that’s done, the custom dimension of discount will be added to the reports.
The data might take some time to populate. We recommend giving a few hours’ time for the data to load completely.
Additionally, you can also add this parameter to any other session-based report to verify the discounts availed by the users.
All we did here is that we just extended the dataset of Google Analytics with another dimension that is customized to our needs.
In the end, you’ll need to submit this as a version to make the data live for all the users from the Google Tag Manager.
So that’s how you create your own custom UTM parameters via Google Tag Manager.
This is just one of the examples for customizing the Google Analytics installation to accommodate your needs.
You can add more than 20 custom dimensions to your Google Analytics account and track various things to optimize the installation according to your website needs.
Were you able to create your own custom dimensions? Where else can you use this technique? Let us know in the comments down below.