UTM Parameter in Google Ads automatisiert setzen

Automate UTM parameters in Google Ads with campaign names

Automate UTM parameters with campaign names in Google Ads: Anyone 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’ll learn why you should automatically set campaign names with UTM parameters in Google Ads and how to install the script for it.

Why are UTM parameters important in Google Ads?

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 attribution and not via the UTM parameters.
If you want to have readable campaign names and ad group names in Matomo, for example, this 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 allow for a good evaluation of 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.

Example:
campaign = My%20Campaign%20Name
adgroup = My%20Ad%20Group%20Name

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. As soon as there are minor campaign changes to the AdGroups and someone doesn’t think about it, everything is broken again.
Here we go again! (If you’re frustrated now, read on. Everything will be fine).

Best practices for using UTM parameters

To ensure your UTM parameters deliver the desired results, you should follow these best practices: Consistent naming: Use uniform naming conventions for campaigns to facilitate the analysis of your data. For example, all campaigns running on Facebook should use the medium ‘social’ and the source ‘facebook’. No special characters: Avoid special characters and spaces in the parameters, as these can cause tracking problems. Use hyphens or underscores instead. Clarity and precision: Keep the naming as clear and precise as possible, e.g., utm_campaign=sale_2025 instead of utm_campaign=promotion. Regular review: Check the parameters of your URLs at regular intervals. This ensures that they still correspond to current campaigns and strategies. By following these best practices, you optimize the quality of your tracking data and can manage your marketing efforts more effectively.

Anyone who wants to set UTM parameters for other networks in addition to Google Ads should definitely check out the blog article about it.

Advantages of automating UTM parameters in Google Ads

Automating UTM parameters offers numerous advantages for marketers who want to manage their campaigns more efficiently. A crucial advantage is time savings: Manually adding UTM parameters in Google Ads to each campaign can quickly become tedious, especially with a large number of ads. Automation standardizes and significantly accelerates this process. Moreover, automation minimizes the risk of errors. Typos or inconsistent parameters can affect the accuracy of data analysis. A clean automated workflow ensures that tracking URLs are always correct and consistent. This allows marketers to collect reliable data and make informed decisions for their future campaigns. Automation thus also contributes to better transparency and higher efficiency.

Automatically set UTM parameters in Google Ads with script

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 statuses “Enabled” and “Paused” are selected.
    In campaigns, the custom 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.

Step-by-step guide to implementing the script

Implementing a script to automate UTM parameters in Google Ads is easier than many assume. Here’s a brief guide: Create script: Log into your Google Ads account and navigate to ‘Tools and Settings’ → ‘Scripts’. Click on ‘+’ to create a new script. Insert script: Copy the script from this article and paste it into the editor. Configure parameters: Adjust the variables in the script to your campaign structure. Define which parameters should be set automatically, e.g., utm_source, utm_medium, or utm_campaign. Test script: Before activation, you should test the script to ensure it works correctly. Use the test function in Google Ads for this. Schedule script: Determine how often the script should run, e.g., daily, to ensure new campaigns are automatically tagged with the correct parameters. These steps make it easy to integrate the script into your campaign management and benefit from the advantages of automation.

Common mistakes and how to avoid them

Errors can also occur when using UTM parameters. The most common ones include: Forgotten URL encoding: Parameters like spaces or special characters can lead to errors if not correctly encoded. Use tools like a URL builder to ensure your links are properly formatted. Inconsistent parameters: Different spellings, e.g., “Google” and “google”, can cause data to be fragmented in Analytics. Stick to a defined schema. Too many parameters: Sometimes too many parameters are added, unnecessarily inflating the URL and making it difficult to understand. Limit yourself to the most important information. Irregular usage: If only a portion of your campaigns are tagged with UTM parameters, data gaps occur. Automation helps to avoid this. Paying attention to these points minimizes errors and ensures that your tracking data is complete and reliable.

Conclusion

Making UTM parameters in Google Ads campaigns human-readable is a challenge when done manually. If you configure a Google Ads script for this purpose, it will do the job reliably.