Facebook and Meta ads UTM parameters: dynamic macros and a pattern GA4 reads
Add UTM parameters to Meta ads in the Tracking section, use Meta's name and ID macros, and keep source and medium consistent for GA4.
On this page
Add UTM parameters to a Meta ad in the Tracking section of the ad creation flow in Meta Ads Manager, as Meta's developer documentation (opens in a new tab) describes. Write them as key=value pairs joined with &, and use Meta's macros (opens in a new tab), such as {{campaign.name}}, for names and IDs. When someone clicks the ad, the URL parameters are sent to Google Analytics (opens in a new tab) and show in the Traffic acquisition report.
Where UTM parameters go in Meta Ads Manager
Meta lets advertisers specify UTM parameters at the ad level (opens in a new tab), under the Tracking section of the ad creation flow in Ads Manager. When a user clicks the ad, the request URL then contains parameters that tools like Google Analytics can read.
The format is the one Meta documents for URL tags (opens in a new tab): custom tags as key=value, where you choose both the key and the value, combined with the & character. For UTM tags, use the campaign parameters Google Analytics reads (opens in a new tab) as keys: always utm_source, utm_medium and utm_campaign, plus utm_content to differentiate creatives.
If you create ads through the Marketing API instead, the ad creative (opens in a new tab) takes a set of query string parameters that replace or are appended to URLs clicked from page post ads, the message of the post and canvas app install creatives only.
Build a campaign link
Create a UTM link with the free builder. No account needed.
Meta's dynamic macros
Meta provides special macros for the value side of a tag. Meta's URL tag guide (opens in a new tab) lists these for tracking campaigns:
| Macro | What it holds |
|---|---|
| {{campaign.name}} | Campaign name |
| {{campaign.id}} | Campaign ID |
| {{adset.name}} | Ad set name |
| {{adset.id}} | Ad set ID |
| {{ad.name}} | Ad name |
| {{ad.id}} | Ad ID |
For example, {{ad.name}} is dynamically replaced with the ad's name when the ad is rendered.
Renaming after launch
Name-based macros have special behaviour. When an ad is first published, Meta stores the name values in a snapshot, and name-based parameters then pull from that snapshot rather than the live name. Renaming a campaign later does not change the utm_campaign value its ads send. If names may change, add the ID macros as well.
A UTM pattern for Meta ads
Google's campaign URL guide (opens in a new tab) has tagging advice that fits Meta ads:
- Always use
utm_source,utm_mediumandutm_campaign. - Use one unique source for each platform, and a distinct source for each sub-platform, such as Facebook and Instagram.
- Use one unique medium for each channel, for example
paid_social. - Use one campaign name that matches the exact campaign name, for example utm_campaign={{campaign.name}}, so a single effort does not split into several rows.
- Use lowercase as a standard:
Metaandmetaare different values.
A pattern that follows it, for an ad that runs on Facebook:
| Parameter | Value |
|---|---|
utm_source |
|
utm_medium |
paid-social |
utm_campaign |
{{campaign.name}} |
utm_content |
{{ad.name}} |
Joined with &, that is utm_source=facebook&utm_medium=paid-social&utm_campaign={{campaign.name}}&utm_content={{ad.name}}.
utm_content differentiates creatives, so the {{ad.name}} macro (opens in a new tab) there tells ads in one campaign apart. Google also suggests dynamic UTMs where a platform supports them, giving {{site_source_name}} as an example, and notes that dynamic parameters vary by advertising platform.
Type the macros directly in Ads Manager. For the static values, the free UTM builder builds a campaign URL with UTM parameters for GA4 and reminds you to pick facebook or fb, never both. For Instagram placements, give Instagram its own source value. Because GA4 values are case sensitive, lowercase campaign, ad set and ad names keep the macro values consistent with the lowercase advice above. Keep the agreed spellings in a naming worksheet for your team.
How Meta ad traffic shows up in GA4
Open Acquisition > Traffic acquisition and look at Session source/medium, Session medium, Session source and Session campaign (Google's campaign URL guide (opens in a new tab)). Parameter values are case sensitive, and missing parameters show up as (not set). When a custom campaign is processed, the campaign parameter values map directly (opens in a new tab) to the report dimensions. Each session is associated with only one campaign or traffic source.
GA4's default channel rules (opens in a new tab) decide the channel:
- Paid Social covers visits from ads on social sites like Facebook: the source must match Google's regex list of social sites and the medium must match
^(.*cp.*|ppc|retargeting|paid.*)$.paid-socialmatches that pattern. - Organic Social matches a source on that list of social sites, or a medium such as
socialorsocial-media.
Channel definitions are not case sensitive. When no rule matches, Analytics uses Unassigned. Google publishes a downloadable spreadsheet of the default channel group's sources and categories; check that your source value is on it. The GA4 channel guide has the rules by medium, and the UTM parameters reference has one section per parameter.
fbclid and UTM parameters
Meta's ClickID (opens in a new tab) is a Meta-generated parameter passed with the URL of your website when someone clicks an ad on Facebook or Instagram, read from the fbclid query parameter. ClickID auto-attachment does not affect other custom tracking parameters you have enabled, so your UTMs stay as you set them. The ClickID value is case sensitive: do not change its case before using it.
Checks before launch
- Paste the final URL, with real values in place of the macros, into the UTM link checker to see what is wrong with its UTM parameters and which GA4 default channel it should land in.
- The checker reads the text of the link only. It does not open the page, follow redirects or check that your analytics tag is installed, so also open the landing page yourself.
- Read the ad's final URL before launch: it should carry each UTM parameter once, with exactly the source, medium and campaign values you set.
- Check that every ad in the campaign uses the same source and medium spelling.
Sources
- Meta for Developers: audience-type URL parameters (opens in a new tab)
- Meta for Developers: URL tags for tracking (opens in a new tab)
- Google Analytics: campaign URL parameters (opens in a new tab)
- Meta for Developers: ad creative reference (opens in a new tab)
- Google Analytics: campaign data and traffic sources (opens in a new tab)
- Google Analytics: default channel group (opens in a new tab)
- Meta for Developers: fbp and fbc parameters (opens in a new tab)
Tools for this
-
Free UTM builder
Build a link with your campaign parameters.
-
UTM link checker
Check a tagged link and see which GA4 channel it lands in.
Frequently asked questions
If I rename a Meta campaign, do the UTM values on running ads change?
No. Meta stores the name values in a snapshot when the ad is first published, and name-based parameters pull from that snapshot rather than the live name.
Which macro gives the campaign name in a Meta ad URL?
{{campaign.name}}. Meta also lists {{adset.name}}, {{ad.name}}, {{campaign.id}}, {{adset.id}} and {{ad.id}}.
Does fbclid replace UTM parameters?
No. fbclid carries Meta's ClickID, and Meta says ClickID auto-attachment does not affect other custom tracking parameters you have enabled.
Build a campaign link
Create a UTM link with the free builder. No account needed.