Rule: Set UTM Parameters#
This rule is suitable for online stores that want to measure campaign performance in Google Analytics or other analytics tools.
Extra features#
- Allow diacritics in values
- Text and variables can be used in all fields
Practical examples#
Example 1: Add UTM parameters to product URLs for traffic measurement#
1. Creating a new rule:
- Open the “Rules” page.
- Click the New rule button.
2. Selecting the rule type:
- In the Rule type field, select the Set UTM Parameters option.
3. Selecting products:
- In the Query field, choose either All products or create your own Product query for specific products you want the rule to apply to.
4. Choosing the element to change:
- In the Element field, select the element you want to modify.
- In our case, this will be the element with the URL (for example: g:link, URL, etc.)
5. Fill in the campaign specification fields (fields are not required):
- In each parameter, you can use not only fixed values (text) but also variables that allow you to dynamically generate values for each product.
- utm_id – unique campaign ID, for example:
123 - utm_source – traffic source identification, for example:
Google - utm_medium – marketing medium, for example:
cpc,email - utm_campaign – campaign name, for example:
summer_sale_2025 - utm_source_platform – multi-platform ad networks, for example:
instagram_ads - utm_content – used to differentiate links, for example:
button_discount - utm_term – keyword used in the ad, for example:
product-xyz
- utm_id – unique campaign ID, for example:
6. “Allow diacritics” checkbox:
- Check this if you want to use diacritics in parameters. Otherwise, Mergado will remove them.
7. Naming the rule:
- In the last step, enter the rule name.
Example 2: Add other element values to UTM parameters#
For example: a value from custom_label.
1. Creating a new rule:
- Open the “Rules” page.
- Click the New rule button.
2. Selecting the rule type:
- In the Rule type field, select the Set UTM Parameters option.
3. Selecting products:
- In the Query field, choose either All products or create your own Product query for specific products you want the rule to apply to.
4. Choosing the element to change:
- In the Element field, select the element you want to modify.
- In our case, this will be the element with the URL (for example: g:link, URL, etc.)
5. Fill in the campaign specification fields (fields are not required):
- In each parameter, you can use not only fixed values (text) but also variables that allow you to dynamically generate values for each product.
- utm_id – unique campaign ID. Use the value of another element by entering its path, for example:
%id%. - utm_source – traffic source identification. Use the value of another element by entering its path, for example:
%source%. - utm_medium – marketing medium (e.g., cpc, email). Use the value of another element by entering its path, for example:
%medium% - utm_campaign – campaign name. Use the value of another element by entering its path, for example:
%campaign%. - utm_source_platform – multi-platform ad networks. Use the value of another element by entering its path, for example:
%source_platform%. - utm_content – link differentiation (e.g., button, banner, text). Use the value of another element by entering its path, for example:
%content%. - utm_term – keyword used in the ad. Use the value of another element by entering its path, for example:
%term%.
- utm_id – unique campaign ID. Use the value of another element by entering its path, for example:
5. “Allow diacritics” checkbox:
- Check this if you want to use diacritics in parameters. Otherwise, Mergado will remove them.
6. Naming the rule:
- In the last step, enter the rule name.
FAQ#
What is the Set UTM Parameters rule for?#
The rule is used to automatically add UTM parameters to product URL addresses. It helps e-shops track campaign performance in Google Analytics, GA4, Sklik, Meta Ads, and other tools. It can be used for all products or only for selected product queries.
Which UTM parameters can I set?#
The rule supports all common parameters:
utm_id– unique campaign ID, e.g.,123utm_source– traffic source, e.g.,Google,Facebookutm_medium– marketing medium, e.g.,cpc,emailutm_campaign– campaign name, e.g.,summer_sale_2025utm_source_platform– platform, e.g.,instagram_adsutm_content– link differentiation, e.g.,button_discount,bannerutm_term– campaign keyword, e.g.,product-xyz
Can I use variables in UTM parameters?#
Yes. In each field, you can enter a variable instead of text – e.g.: %id%, %source%, %medium%, %campaign%, %content%. This dynamically fills the parameters with values from other elements.
💡 Example:
utm_campaign = %custom_label_0% means Mergado will fill in the value from the custom_label_0 element.
What happens if the variable is empty?#
If the variable is empty, Mergado will not add the corresponding UTM parameter to the URL.
💡 However, if the empty variable is between two other values, double spaces or empty characters may remain in the result. In that case, we recommend using the Find and Replace rule with the search expression \s{2,} (two or more spaces) and replacing it with a single space.
How are UTM parameters added to URL addresses?#
Mergado automatically detects whether the URL already contains a question mark ?:
- if it does not, it adds parameters in the form
?utm_source=..., - if it does, it adds new parameters using
&utm_medium=....
This ensures the resulting URL remains valid.
Can I allow the use of diacritics in parameters?#
Yes. By checking the “Allow diacritics” option, you can keep diacritics in parameter values. If you leave this option unchecked (recommended), Mergado automatically converts all characters to ASCII without diacritics, e.g.: krenova → krenova.
What if I want to add UTM parameters only for some products (e.g., only for the “Summer sale” query)?#
Simply select the appropriate product query in the “Query” field (e.g., Summer_sale) – UTM parameters will then be applied only to products in this query. Other products remain unchanged.
What if the URL already contains other UTM parameters?#
If the URL already contains UTM parameters, Mergado will not add them again but overwrites the existing ones. This prevents duplicates and maintains a clean URL structure.
Can the rule be used for analytics systems other than Google Analytics?#
Yes. UTM parameters are standard across systems. You can also use them for GA4, Meta Ads, Sklik, TikTok Ads, Heureka conversion measurement, etc. Just choose the appropriate values in the parameter fields.
How do I check if the rule was applied correctly?#
After saving and applying the rules or after regenerating the feed, check the result:
- in the product preview (URL element), or
- using the Rule walkthrough feature, where you can see how the parameters were added to the URL.
💡 It is also recommended to test using a UTM builder or Google Campaign URL Builder to verify correct syntax.
Can the rule be combined with other rules?#
Yes, it is often used together with:
- Rewrite – for modifying the URL itself before adding UTM parameters,
- Find and Replace – for cleaning the URL from unwanted characters,
- Remove diacritics – if the export platform does not allow diacritics in links.
Can the rule be scheduled (e.g., for short-term campaigns)?#
Yes. Using the timer, you can specify the period when the rule should be active – e.g., during the duration of a specific marketing campaign. After the period ends, the parameters will stop being added.