Dynamic UTM parameters for Meta and Google Ads
Short answer
Dynamic UTM parameters use platform macros that fill in automatically at click time. In Meta, add values like {{campaign.id}}, {{adset.id}} and {{ad.id}} in the ad's URL parameters field. In Google Ads, use ValueTrack parameters such as {campaignid}, {adgroupid} and {creative} in a final URL suffix or tracking template. Prefer IDs over names, because IDs never change.
Typing UTMs by hand for every ad is slow, and it breaks the moment someone duplicates an ad set and forgets to edit the link. Both Meta and Google can fill those values in for you at the moment of the click. Set it up once at the right level and every visit, lead and order can be traced to the exact ad that produced it.
IDs beat names as the value you store
This is the one decision that matters most, so settle it before touching any settings.
Ad names change. A media buyer renames "Sofa video v2" to "Sofa video v2 WINNER" halfway through the month, and every click after that carries the new name. Your analytics now shows two rows for one ad. Names also contain spaces, slashes and emoji that get encoded into ugly strings.
IDs do not change for the life of the object. An ad ID in the URL can be joined to the ad platform's spend export, to a creative thumbnail, and to whatever name the ad has today. Use IDs in the parameters that matter for analysis, and add names only as a readability extra if you want them.
Meta: URL parameters with dynamic macros
In Meta Ads Manager, ads have a URL parameters field in the destination section. At the time of writing it sits under the website URL with a helper to build parameters; menu labels move around, so look for "URL parameters" if it is not where you expect.
A practical string:
utm_source=facebook&utm_medium=paid-social&utm_campaign={{campaign.id}}&utm_term={{adset.id}}&utm_content={{ad.id}}&placement={{placement}}&site={{site_source_name}}
What each macro returns:
| Macro | Returns |
|---|---|
{{campaign.id}} / {{campaign.name}} |
Campaign ID or current campaign name |
{{adset.id}} / {{adset.name}} |
Ad set ID or current ad set name |
{{ad.id}} / {{ad.name}} |
Ad ID or current ad name |
{{placement}} |
Where the ad appeared, such as a feed or stories placement |
{{site_source_name}} |
Short code for the app, such as Facebook, Instagram or Audience Network |
Meta also appends its own fbclid click ID to the landing URL automatically. Your UTMs do not replace it; they sit alongside it.
Applying it at scale
Paste the string into one ad, check it, then apply it to the rest in bulk. You can select many ads and edit the URL parameters field together, or put the string in a bulk import sheet. Because the macros are dynamic, the same string works on every ad in the account. That is the main advantage over hand-built links.
Testing before spend
Use the ad preview link or a live ad with a tiny budget, click through, and look at the address bar on your landing page. You should see real numbers in place of the curly-brace macros. If you see the literal text {{ad.id}}, the macro was typed wrongly (Meta's macros use double braces) or the field was saved on the wrong level.
Google Ads: ValueTrack parameters
Google's equivalent is ValueTrack. You can put parameters in two places:
- Final URL suffix: just the query string, appended to the landing page. Simplest option for most accounts.
- Tracking template: the full URL, starting with
{lpurl}, used when you route clicks through a third-party tracker.
Set either at account level so every campaign inherits it, then override at campaign or ad group level only when needed. A final URL suffix example:
utm_source=google&utm_medium=cpc&utm_campaign={campaignid}&utm_term={keyword}&utm_content={creative}&adgroup={adgroupid}&matchtype={matchtype}&network={network}&device={device}
Some practical notes:
- ValueTrack has historically offered campaign and ad group IDs rather than names. If you need names in the URL, custom parameters at campaign level can hold them, but IDs joined to an export are usually cleaner.
- Some values are blank depending on campaign type. Performance Max and Shopping traffic often has no
{keyword}, and ad group or creative IDs may be empty or behave differently. Check a few real landing URLs from each campaign type. - Keep auto-tagging on. It adds
gclid, which Google Ads conversion tracking and offline imports rely on. Manual UTMs are for your own analytics and CRM, not a replacement for the click ID. Some analytics setups prioritize auto-tagged data over manual UTMs for Google traffic, so confirm how yours resolves the two.
Joining clicks back to spend: a worked example
A boutique furniture store in Brisbane runs three Meta ads for a solid-oak dining range. Their order system stores the utm_content value from each buyer's landing URL. Over 30 days:
Ad ID (from utm_content) |
Meta spend | Store orders with this ID | Store revenue | Cost per order |
|---|---|---|---|---|
| 120207734410530 | $2,940 | 11 | $20,350 | $267.27 |
| 120207734410531 | $1,610 | 9 | $15,840 | $178.89 |
| 120207734410532 | $3,380 | 6 | $9,960 | $563.33 |
Spend comes from an Ads Manager export with the ad ID column switched on; orders and revenue come from the store. The join key is the ad ID, so it does not matter that the third ad was renamed twice during the month.
The result reads differently from Ads Manager's own ranking. Say Meta reported the third ad as the strongest on purchases because it attracted lots of view-through credit. In the store's last-click view it brought the fewest orders at the highest cost. Neither view is the whole truth: UTM-based orders miss buyers who came back through a search or a typed URL, and Meta's view counts people who may have bought anyway. But when two sources disagree this sharply about one ad, it deserves a closer look before it gets more budget. UTM tracking vs platform attribution explains how to hold both views at once.
Where dynamic parameters go missing
The macros work; the delivery is what fails. Common leaks:
- Redirects on your site that drop the query string, such as a forced trailing slash or a
wwwredirect configured without passing parameters. - Forms and checkouts on other domains that do not carry the parameters across. Store them on arrival and pass them on.
- Single-page apps that rewrite the URL on load before your scripts read it.
- Link shorteners in organic posts that someone reuses from an ad.
The first test is always the same: click a live ad and inspect the landing URL, then submit a test lead and confirm the IDs arrived in the CRM record. If they vanish somewhere between, how redirects and link shorteners strip UTMs and click IDs walks through the diagnosis. For hand-built links outside paid ads, keep the casing and vocabulary rules from UTM naming conventions that still work a year later.
FAQ
Should I put Meta ad names or ad IDs in utm_content?
Use the ad ID. Names change when people rename ads and produce split rows in analytics, while the ID stays the same and can be matched to any export or thumbnail later.
Do I need UTMs on Google Ads if auto-tagging is on?
Auto-tagging covers Google Ads conversion tracking and linked Google analytics. UTMs or ValueTrack parameters are still useful when your CRM, form tool or another analytics product needs to read campaign data directly from the URL.
Why does my landing URL show {campaignid} literally?
The parameter was placed where Google does not substitute values, the braces or spelling are wrong, or you are viewing a URL that never passed through an ad click. Test from a real ad click or the ad preview tool.
Can one Meta URL parameter string work across all my ads?
Yes. Because the macros fill in per ad at click time, a single string can be applied in bulk to every ad, and each click still carries its own campaign, ad set and ad IDs.
See your own numbers with the source attached
Adtrix connects Meta and Google Ads read-only, shows each ad next to its spend and reported results, and keeps CRM leads and booked calls in their own lane.