Search
Close this search box.

How to Create Custom UTM Parameters via Google Tag Manager

Last Modified on June 6, 2024

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. 

GTM For Beginners

Sign up to the FREE GTM for Beginners Course...

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!

UTM Campaign

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.

🚨 Note: If you’re using Google Analytics 4, check out our handy guide and learn how to track UTM codes in GA4.

We have created a demo newsletter for mailing our audiences. 

Each different link provides a different discount rate. 

Customizing URL parameters for different links on a mail to the user

The URL parameters of these links are readable by Google Analytics. They further transfer this data into the campaigns. 

Acquiring the query string of the URLs from the mail

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. 

Accessing the all campaigns reports from the acquisition section of Google Analytics

You can use various parameters including the keyword or also the Source/Medium campaigns. 

Accessing the source/medium reports in Google Analytics

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.

Using Google Analytics Campaign URL Builder tool to create customized URL with different parameters 

In addition to that, you can also add the Campaign Term and the Campaign Content to the URL. 

🚨 Note: We’ve created a tool that automatically tracks lead source information inside of your CRM.

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. 

Customizing URL parameters for different links on a mail to the user

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

Configuring a new keyword and value pair to the website URL string

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. 

Creating a new variable from the Google Tag Manager account

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

Configuring a new URL type variable in Google Tag Manager

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

Accessing the URL discount parameter from the Google Tag Manager extension on the website

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

Verifying the modified URL discount parameter from the Google Tag Manager extension on the website

Once we have captured this information into the variables, we’ll send this to Google Analytics by using a custom dimension. 

Custom Dimension

On your Google Analytics account, navigate to Secondary dimensions, you’ll find all your Custom Dimensions here.  

Accessing custom dimensions from the secondary dimensions on Google Analytics reports

Let’s learn how to configure them! 

Open the Admin Settings and navigate to Custom Definitions → Custom Dimensions → New Custom Dimension

Adding a new custom dimension for the UTM parameters from Google Analytics

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

Adding a custom dimension from the Google Analytics account

Next, we’ll need the dimension value of the dimension we just created. In our case, the value is 3

Accessing the dimension value from the created custom dimension 

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

Accessing the custom dimension section to modify and add values in the Tag from Google Tag Manager

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

Configuring custom dimensions to a Tag on Google Tag Manager

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

Accessing the custom dimension section to modify and add values in the variable from Google Tag Manager

The Index number is 3 in our case, and choose the Dimension Value as url – discount.

We’ll Save it once done. 

Configuring custom dimensions to the variable on Google Tag Manager

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

Verifying the fired Tag information from Google Tag Assistant

Let’s now learn to analyze these results from the Google Analytics account. 

Acquisition Reports

We’ll open Acquisition → All Traffic → Source/Medium

You can see the newsletter/email source mentioned. 

Accessing the campaign data from the source/medium reports on Google Analytics

We can open the Secondary dimension and search for discount, and click on it. 

Configuring the discount custom UTM parameter in the report section of Google Analytics

Once that’s done, the custom dimension of discount will be added to the reports. 

Verifying the discount custom UTM parameter in the report section of Google Analytics

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. 

FAQ

What is the purpose of accessing campaign data from the source/medium reports in Google Analytics?

Accessing campaign data from the source/medium reports in Google Analytics allows you to analyze the performance of different marketing campaigns and identify the sources and mediums that drive traffic to your website. It helps you understand which channels are most effective in driving conversions and enables you to make data-driven decisions for your marketing strategies.

How do I configure the discount custom UTM parameter in the report section of Google Analytics?

Configuring the discount custom UTM parameter in the report section of Google Analytics involves setting up a custom dimension. Once you have created the custom dimension for “discount,” it will be added to your reports. This allows you to track and analyze the discounts availed by users based on the UTM parameters in your marketing campaigns.

Can I use custom dimensions for purposes other than tracking discounts?

Absolutely! Custom dimensions in Google Analytics provide flexibility to track various aspects of your website and marketing campaigns beyond discounts. You can create more than 20 custom dimensions to capture and analyze specific data points such as user behavior, campaign performance, content engagement, or any other metrics relevant to your website’s goals and objectives.

Summary

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. 

Learn more about Google Analytics 4 custom dimensions 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.