Facebook, TikTok & Google Ads URL parameters builder
Pick a traffic source, tick the fields your tracker needs and choose how to name them. You get the string for the platform's URL parameters field and, once you paste your tracker link, the full URL with every macro still readable.
Result
Parameter string
Paste into the ad's URL parameters field, without a leading ?.
campaign_id={{campaign.id}}&adset_id={{adset.id}}&ad_id={{ad.id}}&sub1={{placement}}&sub2={{site_source_name}} Full URL
https://go.example.com/?campaign_id={{campaign.id}}&adset_id={{adset.id}}&ad_id={{ad.id}}&sub1={{placement}}&sub2={{site_source_name}} - Warning The link uses http://, so browsers mark the landing as not secure. Switch to https:// if your domain has a certificate.
- Note
- Note Encoded braces (%7B %7D) in the base URL were turned back into { } so the macros stay readable.
Where to paste it
Each platform swaps its macros for real values at click time, but only in its own field and its own syntax.
Facebook / Meta Ads
At ad level, in the URL parameters field. Paste the string without a leading ?; the website URL stays clean. App promotion has no separate field: add the parameters to the end of the deferred deep link. Dynamic parameters don't work in collection ads on Instagram placements.
TikTok Ads
Ad details → Destination URL. Paste the full URL, or click Edit under Preview → Build URL parameters and add keys under Custom parameters. With Auto-attach on, TikTok adds its own UTMs (source TikTok, medium Paid, plus an ID and a name), so check the preview for any key set twice.
Google Ads
Final URL suffix at account, campaign, ad group or ad level (in the ad, under Ad URL options), without a leading ?. If a tracker redirect sits in the tracking template, start it with {lpurl}: when {lpurl} isn't at the beginning, Google escapes the final URL.
Macro reference
What each macro turns into and where the platform fills it in. Switch the traffic source above to see the others.
Facebook / Meta Ads
| Macro | Resolves to | Where it works |
|---|---|---|
{{campaign.id}} | Numeric campaign ID | All objectives and placements that support dynamic parameters |
{{adset.id}} | Numeric ad set ID | All objectives and placements that support dynamic parameters |
{{ad.id}} | Numeric ad ID | All objectives and placements that support dynamic parameters |
{{placement}} | Placement code: facebook_feed, instagram_stories, threads_stream and so on | Only the placements Meta lists: Facebook Feed, in-stream reels, Marketplace, Right Column, Instagram Feed and Stories, Messenger, Audience Network, Threads |
{{site_source_name}} | fb, ig, msg, an or th (Threads) | All supported placements |
{{campaign.name}} | Campaign name as it was when the ad was first published | A later rename doesn't change the value |
{{adset.name}} | Ad set name as it was at the ad's first publish | A later rename doesn't change the value |
{{ad.name}} | Ad name as it was at first publish | A later rename doesn't change the value |
{{media_type}} | Media type of the ad | Advantage+ catalog ads only |
fbclid | Meta's click ID, which Meta adds to the URL itself | Not a macro: leave it out of the template |
Source: Meta Business Help Center, checked September 26, 2026.
TikTok Ads
| Macro | Resolves to | Where it works |
|---|---|---|
__CAMPAIGN_ID__ | Campaign ID | Standard and upgraded Smart+ campaigns |
__AID__ | Ad group ID. AID is the ad group, not the ad | Standard and upgraded Smart+ campaigns |
__CID__ | Creative ID. CID is the creative, not the campaign | Standard and Smart+; in Smart+ it is a single asset, not the ad |
__PLACEMENT__ | Placement type: TikTok or TikTok Pangle | Documented for standard campaigns; check Smart+ on a live click |
__CAMPAIGN_NAME__ | Campaign name | Standard and upgraded Smart+ campaigns |
__AID_NAME__ | Ad group name | Standard and upgraded Smart+ campaigns |
__CID_NAME__ | Creative name | Standard and upgraded Smart+ campaigns |
__ADID_V2__ | ID of the ad, the bundle of creative assets | Upgraded Smart+ campaigns only |
__ADID_V2_NAME__ | Name of the asset bundle | Upgraded Smart+ campaigns only |
ttclid | TikTok's click ID, which TikTok adds to the landing URL itself | Not a macro: leave it out of the template |
Source: TikTok Business Help Center, checked September 26, 2026.
Google Ads
| Macro | Resolves to | Where it works |
|---|---|---|
{campaignid} | Campaign ID | All campaign types, including Performance Max and Video |
{adgroupid} | Ad group ID | Search, Display, Shopping, Video. Performance Max uses asset groups instead |
{assetgroupid} | Asset group ID | Performance Max |
{creative} | Unique ID of the ad | Search, Display, Video; not on the Performance Max list |
{keyword} | Account keyword that matched the search (on Display, the page content) | Search and Display; blank in AI Max, DSA and Performance Max; not in Demand Gen |
{matchtype} | e exact, p phrase, b broad, a AI Max keywordless | Search keywords; not on the Video or Performance Max lists |
{targetid} | ID of the keyword (kwd), audience list (aud), DSA target (dsa) or product partition (pla) that triggered the ad | Not in Demand Gen; skips affinity and in-market audiences |
{network} | g Google Search, s search partners, d Display, ytv YouTube, vp video partners, gtv Google TV, x Performance Max, e App engagement | Not in Demand Gen |
{device} | m mobile, t tablet, c computer | All campaign types, including Performance Max |
{placement} | Site where the ad was clicked | Display and Video; not in Demand Gen or on the Performance Max list |
{loc_physical_ms} | Google geo target ID of where the click happened | Campaigns that show ads to people in the targeted locations; works in Performance Max |
gclid | Google's click ID. Auto-tagging adds it to the final URL itself | Not needed in the template; {gclid} only copies the same ID under another key |
Source: Google Ads Help, checked September 26, 2026.
Where it breaks
- 1
A macro arrives as plain text
{{ad.id}} works only on Meta, __CID__ only on TikTok, {creative} only on Google. A literal macro in the click log means the syntax or the placement is wrong: Meta skips collection ads on Instagram, {keyword} is blank in Performance Max, and Demand Gen doesn't support {placement}, {keyword} or {network}.
- 2
UTMs where the tracker needs subs
UTMs feed analytics. Routing, click lookup and postbacks need the tracker's own fields. If Auto-attach or the base link already sets a key, it arrives twice and each system may keep a different value.
- 3
Double encoding
Macros must reach the ad platform exactly as typed. Run the string through a URL encoder and {{ad.id}} becomes %7B%7Bad.id%7D%7D, so the platform no longer sees a macro to replace. Encode an already encoded value and %20 turns into %2520.
- 4
Names instead of IDs
Name macros expand to the full name with spaces as %20, so the link grows with every level. Meta also freezes names at first publish: rename the campaign and the old name keeps arriving. Join reports on IDs and keep names as labels.
Keep the click context all the way to the deposit.
DarkCore captures campaign IDs, sub1–sub10 and fbclid or ttclid on the first click, passes them into the offer link and ties the postback back to the same click.