How to Create Custom UTM Parameters via Google Tag Manager

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. 

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

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. 

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. 

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. 

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. 

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. 

JOIN US!

Master Data & Analytics with Measuremasters

Exclusive Courses & Workshops | Ongoing Troubleshooting | Support Resources, Tools & much more
guest
7 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
SWAPNIL JAYKAR
SWAPNIL JAYKAR
1 year ago

Hello Julian, I am trying to store the Initial Traffic Source in 1st Party cookie, i.e. Organic, Referral, Direct & Email. Now once they are stored. The URL of website does not have any utm strings present in them. Now i want to generate the UTM string parameter and if user clicks on thridparty link (sub domain OR other). The UTM Parameters should capture the actual source, medium, campaign data from the 1st party cookie (__utmzz) and send it to with the link click For Example. user visit using Organic Channel Website URL when loaded – http://www.example1.com And than user… Read more »

Megan
Megan
8 months ago

Thank you for this! I have set this up for my site, but I have a question about how the data appears in Google Analytics. When users land on a page via a URL tagged with my custom UTM parameter (utm_audience), instead of attributing the visit to that page url (e.g., /index), GA creates a new page URL that appends the custom UTM (but not any of the traditional UTM parameters). For example: If I have an ad driving to the Index page of my site, and I tag it with only traditional UTM parameters–when I look at landing page data… Read more »

Sofiia Bychkovska
Admin
8 months ago
Reply to  Megan

Dear Megan,

Thank you for your feedback! Yes, this is true that Google Analytics is smart enough to process the standard UTM parameters and exclude them from the reports. However, custom parameters require some special treatment and thus additional set-up. So we have 2 options here: either to create a filter in your Google Analytics in order to exclude this parameter or to add the query parameters to the exclusion list.

Reese
Reese
6 months ago

Hi, thanks for the tutorial, really useful. I went through all the steps many times, but the data never appears in GA for me. In GTM I connected it to my pageview tracking tag where I can correctly see dimension: [{index: “3”, dimension: “test}] for a custom dimension called “src” in GA. I also have a variable called {{ url – src }} and the url is using “?src=test”, so everything looks fine in GTM. Unfortunately though the data never appears in GA when I add a “src” secondary dimension to the acquisition reports, although many days have passed since… Read more »

Reese
Reese
6 months ago

I can’t see my custom dimension in the console through the Debugger extension.
But I can see my “test” custom dimension correctly associated both with my Page Tracking tag, and with my Google Analytics settings variable when I preview GTM, which means that my GTM configurations is correct in this case or is there anything else that could go wrong afterwards?

One thing I noticed is that the “Container Loaded” is triggered twice, the second time without triggering any tags – could that be the cause of the custom dimension not working?

Thanks a lot for your help

David Eyler
David Eyler
5 months ago

Could you possibly create a training for creating your own Custom UTM Parameters via GA4 and Google Tag Manager? It seems to be connected to URL query variables and ‘fields to set’ parameter events – but an updated run through would be super helpful.

Blog Categories

Ready to switch to GA4? Subscribe & Get our FREE Course

GA4 for Beginners Free Course

Want to find the Best Sources for Learning GTM? Subscribe & Get our FREE Resource Guide

Google Tag Manager FREE Resource Guide

now it's time to

Start measuring like a master

Itching to jump into the world of MeasureMasters? This is what you have to look forward to.