Automate UTM parameters with campaign names in Google Ads.
Everyone who works with Google Analytics, Matomo or any other web tracker knows the importance of UTM parameters. Through them, it becomes possible to determine the origin of traffic and to target ads.
But setting the parameters manually is time-consuming and error-prone. In this article you will learn why you should set UTM parameters in Google Ads automatically and how to install the script for it.
What are tracking parameters important for?
Tracking parameters are attached to links and read by the web tracker. This makes it possible to assign the path by which the visitor arrived at a website. Google Analytics also assigns the proper campaign names to Google Ads traffic when connected. However, this is created via the gclid assignment and not via the UTM parameters.
If you want to have readable campaign names and ad group names in Matomo, for example, but this one is a rocky road.
Manually setting campaign name and ad group name for UTM parameters in Google Ads
A nice UTM parameter structure would be for example:
utm_source=google&utm_medium=cpc&utm_campaign={Kampagnenname}&utm_content={ad group name}&utm_term={Keyword}
This would also be a good way to evaluate the ad structure in Matomo. I wish. Unfortunately, Google Ads does not provide corresponding variables for campaign name and ad group name. Click here for the list of variables on Google
The solution is the detour via user-defined ValueTrack parameters, in which we enter names accordingly.
Ex:
campaign = My20campaign20name
adgroup = My20adgroup20name
It’s also really easy, because we have to encode special characters and spaces only URL. With spaces the links would not work. So it’s not something you can do quickly on the side while creating a campaign. So as soon as there are minor campaign changes to the AdGroups and someone doesn’t think of it, it’s all broken again.
Runs again! (If you’re frustrated now, read on. Everything will be fine).
Script for automated setting of UTM parameters
The script is a MCC script, which does the job automatically via a defined label and a defined tracking parameter suffix. In all the MCC’s Google Ads account that have the corresponding label.
What the script does:
- Campaigns with the satis „Activated“ and „Paused“ are selected.
In campaigns the user-defined parameter „campaign = {Kampagnenname}“ is set
In ad groups the custom parameter „adgroup = {Anzeigengruppenname}“ is set.
The campaign suffix is set to the value in CONFIG.LABEL_NAME. (This should of course contain the two user-defined parameters accordingly.
Installation instructions:
- Copy and authorize script
- Set variables: CONFIG.LABEL_NAME enter the name of the label, which must be set for the accounts. In CONFIG.SUFFIX the (previously tested!) parameter Link must be added.
- The script can run hourly. Thus, it also eliminates problems with latest campaigns.
- Of course, you should test the links thoroughly with the URL tester.
Conclusion
Making UTM parameters human readable for Google Ads campaigns is manually challenging. If you configure a Google Ads script for this purpose, it will do the job reliably.
Hey, I’ve been testing your script and it seems to be working for most campaign types including PMAX but it doesn’t seem to be working for Standard Shopping? Is that intended? Can it be upgraded to also work for Standard Shopping and set UTM’s at the ad group level? Thanks!
Hi Jameson,
no purpose, I just had no use for it. Feel free to upgrade and share here. I am very time-limited at the moment.