- UTM parameters are tags on the ad URL that tell your reports which source, campaign and ad a visit came from.
- Meta and TikTok fill in campaign, ad set and ad names for you with dynamic parameters, so you set one template and never type names by hand.
- Use fixed lowercase values for utm_source and utm_medium, and put the campaign id in utm_id, so reports still match after a campaign is renamed.
- Test every new ad before launch: click through and check that the final URL still has the parameters after every redirect.
- ROASaurus reads utm_content as the ad name or ad id for creative reports, and utm_id or utm_campaign to match campaign spend to orders.
UTM parameters are tags you add to the landing page URL of an ad, such as utm_source=facebook and utm_campaign=spring-sale, so your reports can tell which source, campaign and ad sent each visit. For Facebook and TikTok ads you do not type the names by hand: both platforms offer dynamic parameters that fill in the campaign, ad set and ad names when someone clicks.
This guide covers the five UTM parameters, the dynamic parameters in Meta and TikTok, a naming system with examples you can copy, the mistakes that break tracking, and how ROASaurus uses UTMs and click ids.
What are the five UTM parameters?
UTM parameters are name and value pairs at the end of a URL, after the question mark. Google Analytics made them common, and most analytics and attribution tools read them. Google says you should always set utm_source, utm_medium and utm_campaign.
| Parameter | What it describes | Example for a paid social ad |
|---|---|---|
utm_source | The site or platform the visit comes from | |
utm_medium | The type of marketing | paid |
utm_campaign | The campaign | us_prospecting_spring-sale |
utm_term | The paid keyword in search ads; in paid social, usually the ad set | broad_25-54 |
utm_content | Which ad or link, to tell creatives apart | The ad name |
utm_id | The campaign id | 120210000000000001 |
Google also lists utm_id, a campaign id. It is worth setting, because names change and ids do not. You will see why in the section on mistakes.
Dynamic parameters in Meta Ads Manager
In Meta Ads Manager you add parameters to each ad in its URL parameters field. Meta's dynamic parameters are placeholders in double curly braces. When someone clicks, Meta replaces them with the real value. These are the ones Meta documents:
| Dynamic parameter | Meta fills in |
|---|---|
{{campaign.name}} | The campaign name |
{{campaign.id}} | The campaign id |
{{adset.name}} | The ad set name |
{{adset.id}} | The ad set id |
{{ad.name}} | The ad name |
{{ad.id}} | The ad id |
{{site_source_name}} | Where the ad ran: fb, ig, msg (Messenger), an (Audience Network) or th (Threads) |
A complete template for Meta uses fixed values for source and medium and dynamic parameters for everything else. This is the template ROASaurus recommends in its Meta setup guide:
utm_source=facebook&utm_medium=paid&utm_campaign={{campaign.name}}&utm_id={{campaign.id}}&utm_term={{adset.name}}&utm_content={{ad.name}}Three details from Meta's documentation matter here:
- Names are frozen at publish. Name parameters use the name the campaign, ad set or ad had when the ad was first published. If you rename it later, the URL keeps the old name.
- Edits can restart learning. Changing URL parameters after you publish may send the ad set back into the learning phase. Set the template before launch.
- Some parameters may be added for you. Meta may add some parameters on its own: a source, a medium of paid, and the ad, ad set and campaign ids. Check the preview URL so you know what is actually sent.
Dynamic parameters are not supported for collection ads on Instagram placements, according to Meta.
Macros in TikTok Ads Manager
TikTok calls its dynamic values macros. They are written in capital letters between double underscores. In the Ad details section, enter the destination URL, click Edit under the preview and choose Build URL parameters to enter them. TikTok documents these macros:
| Macro | TikTok fills in |
|---|---|
__CAMPAIGN_NAME__ | The campaign name |
__CAMPAIGN_ID__ | The campaign id |
__AID_NAME__ | The ad group name |
__AID__ | The ad group id |
__CID_NAME__ | The creative name |
__CID__ | The creative id |
__PLACEMENT__ | The placement, such as TikTok or Pangle |
__ADID_V2_NAME__ and __ADID_V2__ for the ad name and ad id.utm_source=tiktok&utm_medium=paid&utm_campaign=__CAMPAIGN_NAME__&utm_id=__CAMPAIGN_ID__&utm_term=__AID_NAME__&utm_content=__CID_NAME__
Before you launch, open the preview and check that __CID_NAME__ becomes the same name you see for the ad in TikTok Ads Manager, because that is the value ROASaurus matches to the ad. TikTok can also attach UTM parameters automatically, with TikTok as the source and paid as the medium. If you use that option as well as your own template, check the preview so that each parameter appears only once. TikTok also adds its own click id, ttclid, to the landing page URL when someone clicks an ad. You do not need to add it yourself.
A naming system you can copy
Dynamic parameters copy your names into the URL. So a UTM naming system is really a system for naming campaigns, ad sets and ads. Decide it once, write it down and use it on every platform.
| Level | Pattern | Example | Ends up in |
|---|---|---|---|
| Source (fixed) | platform | facebook, tiktok | utm_source |
| Medium (fixed) | type of marketing | paid | utm_medium |
| Campaign | market_goal_offer | us_prospecting_spring-sale | utm_campaign |
| Ad set or ad group | audience_age | broad_25-54 | utm_term |
| Ad | hook:…_creator:…_format:… | hook:problem_creator:anna_format:ugc | utm_content |
The rules behind the table:
- Lowercase for fixed values. Always facebook, never Facebook in one ad and facebook in the next.
- No spaces. Use a hyphen inside a part (spring-sale) and an underscore between parts (us_prospecting_spring-sale).
- The same order of parts everywhere. Market, then goal, then offer. Reports sort and filter better when every name has the same shape.
- Only letters, numbers, hyphens, underscores and colons. Characters such as &, #, ? and = have a meaning in URLs, and a link breaks when a tool does not encode them.
- Creative facts in the ad name. Hook, creator and format, so you can compare them later. See creative fatigue for why this helps.
With this system, a click on a Meta ad lands on a URL like this one:
https://yourstore.com/products/linen-shirt?utm_source=facebook&utm_medium=paid &utm_campaign=us_prospecting_spring-sale&utm_id=120210000000000001 &utm_term=broad_25-54&utm_content=hook:problem_creator:anna_format:ugc &fbclid=IwAR2x...
Common mistakes that break UTM tracking
Spaces and mixed case
Google Analytics treats facebook and Facebook as two different sources, so one channel splits into two rows. Spaces are encoded as %20 or turned into a plus sign, depending on the tool, and filters stop matching. Use lowercase and no spaces in every value you type yourself.
Renaming a campaign after launch
Editing the parameters of live ads
On Meta, changing the URL parameters of a published ad may send its ad set back into the learning phase. Put the template in place before launch. When you duplicate an ad, check its URL parameters field before you publish the copy.
Redirects that drop the parameters
A redirect sends the visitor from one URL to another. If it does not copy the part after the question mark, the UTMs and click ids are gone before your tracking script runs. Common causes:
- Link shorteners and some link-in-bio tools.
- Redirects from an old product URL to a new one that do not keep the query string.
- Country or language redirects to another store domain.
- Landing pages on another domain that link to your shop without passing the parameters along.
For landing pages on another domain, ROASaurus can carry the visitor id, click ids and UTMs across: add the script to the funnel pages and list both domains under Settings › Linked domains. See funnels and landing pages.
Values typed by hand
One ad says paid, another paid-social, a third cpc. Each variant becomes its own row in your reports. Copy the template instead of typing it again.
Testing before launch
- Click through
Open the ad preview, or make a test click, and let the landing page load completely.
- Read the final URL
Check the address bar after all redirects. Every utm_ parameter and the click id (fbclid or ttclid) must still be there.
- Check the values
Source and medium are lowercase, and the names are real names. A literal
{{ad.name}}or__CID_NAME__in the URL means the macro was not filled in. - Check the first orders
After the first sales, open your attribution report and confirm that the orders appear under the right campaign and ad.
How ROASaurus uses UTMs and click ids
The ROASaurus script reads the landing page URL on every page view. When the URL has a click id (fbclid, ttclid, gclid and others) or a UTM parameter, ROASaurus stores a touch for that visitor. When an order comes in, the touches inside your lookback window decide which channel, campaign and ad get the credit. Without a click id or UTM, a visit is not a touch, so direct visits never overwrite an earlier ad click.
| Parameter | What ROASaurus uses it for |
|---|---|
utm_source or a click id | The channel. Meta: an fbclid, or a source of facebook, fb, ig, instagram or meta. TikTok: a ttclid, or a source of tiktok. Upper or lower case does not matter. |
utm_campaign | The campaign name in the attribution report. |
utm_id | The campaign id. Ad spend from Meta and TikTok is matched to orders by campaign id or campaign name. |
utm_term | The ad set or ad group. |
utm_content | The ad. Creative analytics matches it to the ad name or the ad id. |
Two points matter for your template. First, revenue per creative in creative analytics is last click, matched on utm_content. If utm_content holds something other than the ad name or ad id, the ad gets spend but no revenue. Second, campaign ROAS in attribution needs the spend and the orders to match, which is why the campaign id in utm_id helps after a rename.
Click ids and UTMs do different jobs. Meta and TikTok use click ids to match the purchases you send them to the original click, and ROASaurus includes them when it sends each paid order server-side. UTMs are for your own reports. You need both. More in what server-side tracking is.
With Respect visitor consent on (the default), the script sets no visitor id for visitors who decline marketing cookies, so their ad clicks and UTMs are not linked to them. Their paid orders are still sent to your ad platforms server-side, with hashed order data. On Shopify, the order's landing page address is part of the order data, and it can include UTMs and click ids. When there is no touch from the script, for example because the visitor declined or an ad blocker stopped the script, ROASaurus uses that address in its own attribution reports. It does not send it to the ad platforms.
Sources
- Google Analytics Help: URL builders: Collect campaign data with custom URLs
- Meta Business Help Center: Specifications for dynamic URL parameters in Meta Ads Manager
- TikTok Ads Manager: About UTM Parameters
- TikTok Ads Manager: How to add URL parameters to your website URL
- TikTok Ads Manager: About TikTok Click ID
In ROASaurus
- Connect Meta and the UTM template
- Creative analytics
- Attribution in ROASaurus
- Funnels and landing pages