UTM Parameters and Ad Platform Macros: A Complete Guide to Link Tagging

UTM parameters describe where a visitor came from, while ad platform macros insert live values into the link: campaign, ad and placement IDs. Together they turn an ad link into a data source for your tracker.

Tracking and Analytics9 min read
UTM Parameters and Ad Platform Macros: A Complete Guide to Link Tagging
Contents
  1. What are UTM parameters
  2. What are macros and dynamic parameters
  3. How to build an ad link for your tracker
  4. Common macro mistakes
  5. A tag scheme for your team
  6. Tracker macros and platform macros are not the same
  7. UTM parameters and macros in ArtisanClo
  8. Bottom line

A link like example.com/?utm_source=fb&utm_campaign=test will tell you nothing a week from now, when you have forty ads across five campaigns. A link into which the platform itself inserts the campaign, ad and placement IDs turns every click into a report row. Here is how to build that kind of tagging with UTM parameters and macros for the main traffic sources.

What are UTM parameters

UTM parameters (UTM tags) are five standard parameters that come from web analytics and are understood by almost any tracking system:

Parameter What it describes Example value
utm_source Traffic source facebook, google, tiktok
utm_medium Traffic type cpc, cpm, push
utm_campaign Campaign nutra_de_q4 or a campaign ID
utm_content Ad, creative creo_14
utm_term Keyword {keyword}

A link with UTM parameters:

https://example.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=nutra_de&utm_content=creo_14

UTM parameters are handy but static: if you type utm_content=creo_14 by hand, then duplicate the ad and forget to update the tag, your creative stats fall apart. That is why in affiliate marketing UTM parameters are almost always combined with macros.

What are macros and dynamic parameters

A macro (dynamic parameter) is a placeholder in a link that the ad platform replaces with a real value at the moment of the click. You write {campaignid}, and the visitor arrives with campaignid=19283746. The values come from the campaign itself, so you cannot make a mistake when duplicating ads.

Every platform has its own syntax, and that is the main source of errors.

Facebook (Meta Ads) macros

Double curly braces. Entered in the ad's «URL parameters» field.

Macro What it inserts
{{campaign.id}} Campaign ID
{{adset.id}} Ad set ID
{{ad.id}} Ad ID
{{campaign.name}}, {{adset.name}}, {{ad.name}} Names
{{placement}} Placement
{{site_source_name}} Site: Facebook, Instagram, Audience Network
utm_source=fb&utm_campaign={{campaign.id}}&utm_content={{ad.id}}&sub3={{adset.id}}&sub4={{placement}}

Facebook adds the fbclid click ID on its own; you do not need to include it. How Meta macros work together with the Conversions API is covered in Facebook Ads tracking: macros, fbclid, CAPI.

Single curly braces. Set in the tracking template or the final URL suffix.

Parameter What it inserts
{campaignid} Campaign ID
{adgroupid} Ad group ID
{creative} Ad ID
{keyword} Keyword
{matchtype} Match type
{network} Network: Search, Display, YouTube
{device} Device type
{placement} Display Network placement
utm_source=google&utm_campaign={campaignid}&utm_content={creative}&utm_term={keyword}&sub4={network}

With auto-tagging on, gclid is added automatically. The tracking template and offline conversions are covered in how to track Google Ads.

TikTok Ads macros

Double underscores on both sides.

Macro What it inserts
__CAMPAIGN_ID__ Campaign ID
__AID__ Ad group ID
__CID__ Ad ID
__CAMPAIGN_NAME__ Campaign name
__PLACEMENT__ Placement
utm_source=tiktok&utm_campaign=__CAMPAIGN_ID__&sub2=__AID__&utm_content=__CID__

On ttclid and the Events API, see TikTok Ads tracking.

Yandex Direct macros

If you also buy traffic in Yandex Direct, it uses single curly braces too, but with different names: {campaign_id}, {ad_id}, {gbid} for the ad group, {keyword}, {source_type}, {source} and {device_type}. Direct appends its yclid click ID on its own. What these click IDs are and why you need them is covered in fbclid, gclid, ttclid, yclid.

Push, pop and native

Push, pop and native ad networks usually have macros for the zone (placement), campaign, creative and click cost, for example {zoneid}, {campaignid}, {cost}; check the network's documentation for the exact names. Passing the placement is especially important in native and push: it is what you will use to switch off junk sites. More on this in push and pop traffic and native advertising for affiliates.

A good link answers four questions: where from, which campaign, which ad, and what the click cost (if the platform provides it).

The steps:

  1. Take the URL from your tracker or cloaker, not the offer's direct URL.
  2. Add the source parameters: campaign, ad group, ad, placement.
  3. Add your own tags: buyer, combo version, geo, things the platform does not know.
  4. Add the cost if the platform fills it in: cost={cost} or similar.
  5. Check the final URL: click the ad in preview and see what arrived in the click log.

A sample final link for Facebook:

https://example.com/?utm_source=fb&utm_campaign={{campaign.id}}&utm_content={{ad.id}}&sub3={{adset.id}}&sub4={{placement}}&sub5=anna

Tip. Do not put telling values in your tags, like utm_campaign=keto_pills. Spy tools and anyone the link is forwarded to can see it, and telling tags make a funnel easiest to reconstruct. Use IDs or neutral codes and keep the decoding in your tracker.

Common macro mistakes

Another platform's syntax. You copied a template from Google into Facebook, and instead of a campaign ID your reports show {campaignid}. Each platform has its own syntax.

Tags in the website URL instead of the parameters field. In Facebook and Google it is better to enter parameters in the dedicated fields: the platform will join the URL correctly and will not break it with extra question marks.

A double ? in the link. In example.com/?a=1?b=2 the second parameter will not be read. After the first ?, parameters are separated only by &.

Spaces and non-Latin characters in values. Campaign names with spaces arrive URL-encoded. If you insert {{campaign.name}}, name campaigns in Latin characters without spaces.

One template for all campaigns without checking. You copied parameters from an old campaign into a new one, but the new one uses a different ad type where some macros are not supported. Check every new campaign with at least one click.

Manual values nobody updates. utm_content=creo_14 was typed by hand, the ad was duplicated ten times, and all ten copies report «creo_14». Wherever the platform can insert an ID, let it.

Too many extra tags. A long link with a dozen UTM parameters going to the offer can reveal your source to the network or the final site. Strip the extras on the way to the offer.

A tag scheme for your team

When several buyers work in one account, tagging without shared rules quickly turns into chaos: one puts the campaign in utm_campaign, another in sub1, a third in the flow name. Building a report for the whole team becomes impossible. Agree on a scheme in advance.

Parameter What it holds Facebook Google Ads TikTok
utm_source Platform fb google tiktok
utm_campaign Campaign ID {{campaign.id}} {campaignid} __CAMPAIGN_ID__
sub2 Ad group ID {{adset.id}} {adgroupid} __AID__
utm_content Ad ID {{ad.id}} {creative} __CID__
sub3 Placement {{placement}} {placement} __PLACEMENT__
sub4 Buyer manual manual manual

The point of the table is that data with the same meaning lives in the same parameters on every platform. Then a report «by ad» is a single slice by utm_content, whatever the source.

Names or IDs?

Platforms can insert both IDs and campaign names. Each option has its price:

  • IDs are stable, have no spaces and mean nothing to an outsider, but in the report you see 120211875 instead of «Germany, women 35+»;
  • names are readable at a glance, but change when you rename things, can contain spaces and non-Latin characters, and reveal the campaign's meaning to anyone who sees the link.

A practical compromise is to pass IDs and keep the names in the platform and the tracker, matched by number.

How to check your tagging before launch

  1. Click the published ad (a preview only works if the platform fills in macros there).
  2. Look at the URL you arrived with: every macro should be replaced with a value.
  3. Find that visit in the tracker log and make sure the values landed in the right fields.
  4. If {{ad.id}} or __CID__ is still there literally, look for a typo or an unsupported field.

Tracker macros and platform macros are not the same

A funnel involves two kinds of macros, and they are easy to confuse:

  • platform macros are filled into the ad link at the click: {{ad.id}}, {gclid}, __CID__;
  • tracker macros are filled into the offer link when the visitor moves on: {click_id}, {geo}, {sub1}.

The third kind is affiliate network macros in the postback URL: {sub1}, {status}, {payout}. They are covered in detail in the article on S2S postback.

UTM parameters and macros in ArtisanClo

In ArtisanClo, link tagging starts with the traffic source. There are about 180 ready-made platform templates: each template already defines the parameters (keyword, cost, currency, platform click ID, creative, campaign, placement) plus an unlimited number of SubID tags. If a platform is not among the templates, you can add it from the search. The catalog of supported platforms is on the traffic sources page.

When you choose a source on the first step of a flow, its parameters and SubIDs are laid out as campaign tags, from which the flow's ad link is built. On the «Tracking» step (in modes with a tracker) you can change parameter values for a specific flow and add your own SubIDs: lines like sub1 = {sub_id_1}. A new flow without a source starts with sub1–sub30.

If the platform passes the click cost in the link, choose the «From the link» cost model and specify the parameter, for example cost={cost}, and spend will be calculated for every click.

On the way to the offer, tags can be rewritten in the «Offer link parameters» block: renamed (fbclid → sub1), set from a macro (aff_id = {click_id}) or removed (utm_source) so that the platform's tag does not go to the network. In the click log and on the White Page, tags stay as they arrived.

Tags sub1–sub10 are then available in the «Money by slice» table, and the rest in the report builder. For native traffic, the documentation recommends passing the placement ID in a tag, for example sub1={zoneid}, and blocking placements in the network itself where the filter cuts almost everything.

Bottom line

UTM parameters set the overall scheme, platform macros fill it with exact IDs, and the tracker turns all that into reports. Write macros in your platform's syntax, keep one tag scheme for the whole team and check the final URL with a live click. How these tags help tie a click to a conversion is covered in click ID and sub ID, and why you need all this in the first place in affiliate tracker.

Frequently asked questions

01

Do I have to use UTM parameters specifically?

No. UTM is the accepted standard for web analytics, but a tracker does not care what a parameter is called. Many media buyers use sub1–sub10 or their own names. What matters is that the tracker knows what each parameter means and that the scheme stays the same from campaign to campaign.

02

Why does the link show the macro text in brackets instead of a value?

The platform did not fill in the value: the macro has a typo, is not supported in that field, or the link was opened manually rather than through the ad. Check the syntax in the platform's documentation: Facebook uses double curly braces, Google single ones, TikTok double underscores.

03

Where do I add UTM parameters in Facebook Ads?

Add them in the URL parameters field at the ad level, not directly in the website URL. That way Facebook correctly joins the URL and the parameters and fills in the macros. You can also build the string in the parameter builder next to that field.

04

Can I pass the cost per click in the link?

Yes, some platforms, especially push, pop and native networks, can insert the click cost with a macro. Pass it in a parameter such as cost, and the tracker will calculate spend for every click without manual entry.

05

Who else can see UTM parameters in a link?

Anyone who opens the link: spy tools, competitors, anyone the link was forwarded to. So do not put telling values like the offer, network or buyer name in your tags. Use IDs and neutral codes, and keep the decoding in your tracker or a team spreadsheet: that makes your funnel harder to reverse-engineer, and reports do not break when campaigns are renamed.

Read next

See your traffic for real

Connect ArtisanClo to your site, see who actually arrives from your ads, and why every click got its decision.