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.

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:

  1. 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:

  1. Copy and authorize script
  2. 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.
  3. The script can run hourly. Thus, it also eliminates problems with latest campaigns.
  4. Of course, you should test the links thoroughly with the URL tester.


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.