How to Create Custom UTM Parameters via Google Tag Manager

In this video, let’s go through the process of creating custom UTM parameters so you can easily track whatever UTMs you like and then see them directly in Google Analytics.

This comes in handy for things like discounts and other UTM variables not part of Google’s defined set. We’ll be doing this with the help of Google Tag Manager.

In this post, I’m going to show you how you can create your own UTM parameters to include your custom value and transfer this on to your content tracking. So you have that information available in Google Analytics. All the more coming up.

Hey there, Julian here back with another video for you. Today, we want to talk about how we can create a custom UTM parameter. This is actually a question that came from Ahmad who wanted to know how to do this.

And the premise really is, what if you have exhausted your UTM parameters that you have in your URL, and you want to have customer information that is transferred into your Google Analytics? Well, this is actually something we can do pretty easily with the help of Google Tag Manager and then forward this all on as a custom dimension to Google Analytics. So we’ve got lots to cover. Let’s dive in.

All right, to introduce you to our scenario today we have a newletter here, we have different links to our website. And these links, obviously UTM tag, which means they have this which Google Analytics reads automatically and transfers into campaigns, which you can later look up to see where the traffic came from. So for example, here on the acquisition campaigns, you’ll be able to look at all the different campaigns that you have. If you are filling out the UTM term, you might be able to fill out the keyword column or other columns, like the source medium column, right here.

So I’ve built this link with the actual official campaign builder tool here, which is simply a form, which you link and then we have these fields available, the source medium, the campaign name, term, and content. Now three of these are mandatory, but the others can be filled out if you want, or you can leave them empty.

But let’s say you wanted to differentiate from our newsletter here. How much discount I get 90% off, 50% off, 20% off. Unfortunately, all of our forms are here filled, we won’t be able to add this to our information of our campaign UTM sources, and also, frankly, doesn’t quite fit in any of these. If only there was a way to add my own UTM parameter that I just make up, just like, let’s say, discount equals, and in this case, it would be 90%. Now, unfortunately, when you come to the page, Google Analytics won’t grab that information because it doesn’t actually understand it as you are going out of the rule set of UTM parameters and creating your own custom UTM parameter. So today, I want to show you how you can send us on to Google Analytics nonetheless, and thus create your own UTM parameter.

To get started, we need to read this information first of all, so we have the value of the 90 here inside of a variable. So we’re going to go ahead, I already have Google Tag mentioned. So to Google Analytics page, your tag, just into Google Tag Manager, and build a new custom variable, and this will be a URL variable for discount. Let’s go ahead and choose the URL type from our variable menu. And we want to get the component of the query. And here we want to look for a special key within the query. And if you don’t know what the key is, its thing in front of the equal sign, we actually have another video on this show.

I’m also going to link up down below how these query strings actually work. But we are interested in this key to pull this value out. So we simply need to know the key. Okay, this is the key and go back to Google Tag Manager and enter our discount here. That should do it. Let’s save this and try it all out.

Going to go over and refresh our preview and debug mode. refresh our page and upon the page, you we should have have our variable available now, which is our URL discount variable and it holds the value, whatever is filled in here as a discount equals, let’s just try it out, see if it’s dynamic.

And as you can see, this value changes if there’s a different value appear in the URL. So now we have captured this via the variables. And we now want to feed that information into Google Analytics. And we’ll do this via a custom dimension.

So if you want to make up any of these dimensions yourself, you can build custom dimensions. How do you configure them, just in the admin menu, just under your property settings and this column in the middle, we can go for the custom definitions and here we will get the Custom Dimensions I already have some created here, but I will go ahead and create a new one, which will just call discount, and as the scope we choose session as our UTM paramenters are also scoped to the session and keep it active as creators. And all we would need right now is just to know the number right here, which is the dimension number. And in our case, it would be three. So how do we now build this into Google Tag Manager, it’s actually pretty straightforward. inside of our Page tag or any other Google Analytics events, we will need to build in this custom dimension. Right here under the override settings, you can go on the more settings, and here, will see the custom dimensions, we need to add the index, which in our case was three, and then dimension value. In our case, it was this URL discount. So the dimension number three will be filled with whatever is in the URL as value. This is how you can set up a custom dimension in a single Google Analytics tag, you would probably need to go through all the Google Analytics tag.

If you wanted to do this method. We can also actually build this into our Google Analytics settings, variable directly. So let’s do this, as it’s actually the recommended way of building in custom dimensions, especially if they are scope to the session. Go ahead and go into our Google Analytics settings variable. And here we have the same settings available for the custom dimensions, you go with the index three again, and then choose our variable, which was our URL discount right here. Let’s save this and refresh. And let’s go into the preview mode. And here we have our UTM tag link with the 50 attached. And our page to tag file.

Now we can look up in our tag assistant will send over so we have Google Tag mentioned. So Google Analytics here. And this sent our one page request with the custom metrics of dimension number 3 and 50. So this data was sent over to Google Analytics just fine, but how can we now see it inside of our analytics.

Let us go back to our acquisition reports. And we have here all traffic, let’s go to the source medium. We have the right data here, and we see our newsletter email. And we can simply go up here to our secondary dimension and type in our discount. And here we get our custom dimension. And it’s not, it’s filled, probably because we just set up the page a second ago. Be aware that this can take a while up to one half an hour, or even longer to this is calculated. So we just need to check back later if this actually works. But here’s where you would find that data.

You can edit actually to any other session based report to know which discount did the user get if you want to look at an ecommerce report and see through which discount email that the user come you would find this into this field and you just need to activate it as a secondary dimension.

So what we have done in essence is extended the data set of Google Analytics with another dimension and dimension that is custom to our needs. And this is a great example for customizing your Google Analytics installation to fit your needs. Don’t forget, if you want to take this or live in the end, go over to Google Tag Manager and submit this as a version. So this will go live to all your users.

This is how you can create a custom UTM parameter. Will you use this technique? Where would you find this useful? Let me know in the comments down below.


Master Data & Analytics with Measuremasters

Exclusive Courses & Workshops | Ongoing Troubleshooting | Support Resources, Tools & much more
Inline Feedbacks
View all comments

Blog Categories

Join 30,000+ marketers getting exclusive resources and our latest content!

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.