Cookie preferences

Choose which optional cookies EndFrame may use on this site. Analytics and advertising tools load only if you allow them, and you can change your mind any time from “Cookie settings” in the footer. Whatever you choose, this tab keeps the campaign labels from the link that brought you, and they are saved with your account if you sign up. Read the Cookie Policy.

Needed for the site to work, such as remembering this choice. Always on.

Lets us load analytics tools through Google Tag Manager, including Google Analytics and Microsoft Clarity session recordings, to understand how the site is used.

Allows advertising tags to measure our ad campaigns. None run on this site today. It also keeps ad click IDs from the page address for this tab, and saves them with your account if you sign up.

Skip to main content

UTM Parameters for Facebook and Instagram Ads, Using Meta's Dynamic URL Parameters

Meta lets you add UTM parameters once and have campaign, ad set, ad and placement values filled in automatically. This guide gives you a template to paste, explains every dynamic parameter Meta documents, and covers the gotchas that cause mismatched names and missing data in GA4.

The EndFrame Team6 min read

You run dozens of ad sets across Facebook and Instagram, and GA4 shows them as one line of facebook / referral, or splits them across m.facebook.com, l.instagram.com and a handful of other referrers. Without UTM parameters, analytics cannot tell your campaigns apart. Meta's dynamic URL parameters solve the tedious part: you write one parameter string and Meta fills in the campaign, ad set, ad and placement for every click. This guide shows the string to use, where to put it, and the details Meta's documentation spells out that most tutorials skip.

Where UTM parameters go in Ads Manager

Keep the Website URL clean, for example https://example.com/offer, and put the parameters in the separate URL parameters field. In Ads Manager you reach it while creating or editing an ad: complete the ad steps until the Tracking section, then enter your parameters in the URL parameters field or use Build a URL parameter. Meta appends that string to the website URL when the ad is clicked.

Two rules from Meta's help centre are worth knowing. If the same key appears in both the Website URL and the URL parameters field, the URL parameters field wins. And parameters set in Ads Manager override parameters set elsewhere, such as Instagram's default URL parameters. Never leave a key with an empty value; Meta explicitly advises removing a parameter rather than sending it blank.

Because the field lives on each ad, the fastest way to keep it consistent is to set it once on a template ad and duplicate from there, or to paste the same string into every new ad from a saved document. Bulk editing in Ads Manager can update the field across many ads at once, but treat that as a change to live ads, with the learning phase caveat described below, rather than a harmless clean-up.

The dynamic parameters Meta supports

Meta documents the following dynamic parameters at the time of writing. Each is written in double curly brackets and replaced with a real value at click time.

Dynamic parameterReturnsTypical UTM use
{{campaign.name}}Campaign name at first publishutm_campaign
{{adset.name}}Ad set name at first publishutm_term
{{ad.name}}Ad name at first publishutm_content
{{campaign.id}}Campaign IDutm_id or a custom key
{{adset.id}}Ad set IDCustom key
{{ad.id}}Ad IDCustom key
{{site_source_name}}fb, ig, msg, an or thutm_source
{{placement}}Placement, for example facebook_feedCustom key or utm_content
{{media_type}}Media type, Advantage+ catalog ads onlyCustom key

A template you can paste

This string covers the five standard UTM fields and keeps IDs alongside the names, so you can join analytics data back to Ads Manager even if names are messy:

utm_source={{site_source_name}}&utm_medium=paid_social&utm_campaign={{campaign.name}}&utm_term={{adset.name}}&utm_content={{ad.name}}&utm_id={{campaign.id}}&placement={{placement}}

utm_medium is static, because the type of marketing never changes: it is always paid social. paid_social matches GA4's paid pattern, as do cpc and paid. Pick one and keep it. Using the ad set for utm_term and the ad for utm_content is a common convention rather than a rule; our guide to utm_content vs utm_term explains the alternatives. For the reasoning behind the medium value, see utm_source vs utm_medium.

Source: dynamic code or a static platform name?

{{site_source_name}} tells you whether the click came from Facebook, Instagram, Messenger, Audience Network or Threads, which is valuable when ads run across placements automatically. The trade-off is that the values are short codes. GA4 puts a session into Paid Social only when the source matches its list of social sites and the medium matches a paid pattern. If you see these sessions under Paid Other instead of Paid Social, the source value is not on GA4's list, and you can either map the codes in a custom channel group or use a static source such as facebook. Check your own property after the first day of traffic rather than assuming.

The name-based parameter trap

This catches almost everyone. Meta sets {{campaign.name}}, {{adset.name}} and {{ad.name}} to the names used when the ad was first published. You can rename the campaign later, but the URL keeps the original name for the life of that ad. So a campaign launched as "Copy of Prospecting" and renamed the next morning sends "Copy of Prospecting" to GA4 forever.

  • Finalise names before you publish, using your naming convention.
  • Avoid spaces in names. Meta encodes them as %20, which works but makes reports and exports harder to read.
  • Use lower case, because GA4 treats different capitalisation as different values.
  • Keep {{campaign.id}} in the URL so you can always join back to the current name in Ads Manager.
  • Remember that changing URL parameters on a live ad may push the ad set back into the learning phase.

Name campaigns so the values are worth reading

Dynamic parameters copy whatever you typed into Ads Manager, so the quality of your GA4 data now depends on your naming. A name like "New campaign 3" becomes utm_campaign=New%20campaign%203 in every session it drives. A structured name carries real information into analytics without any extra fields. A simple pattern is objective, audience and offer joined by hyphens, for example leads-lookalike-free-trial for the campaign and video-testimonial-v2 for the ad. Agree the pattern before anyone builds the next campaign, store it where the team can see it, and treat a misnamed campaign as something to fix before publishing rather than after.

Ad set names deserve the same care. If utm_term carries the ad set, an ad set named after its audience (broad-uk-25-44, retargeting-30d) turns GA4's Session manual term report into an audience comparison. Duplicated ad sets are the usual weak point, because Ads Manager adds "Copy" to the name and the name-based parameter keeps it for good once the ad publishes.

Where dynamic parameters do and do not work

Meta lists dynamic parameters as available for Awareness, Traffic, Engagement, Leads, Sales and App promotion objectives, with conditions on conversion location for some of them. For App promotion there is no separate field; you append the parameters to the deferred deep link. Meta also notes that dynamic URL parameters are not supported for collection ads on Instagram placements. When an ad promotes an existing post that links off Facebook, the parameters apply only to clicks on the ad, not to people who see the post organically.

Checking that it works

  1. 1Use the ad preview to open the destination and confirm the full URL shows real values, not literal curly brackets.
  2. 2Confirm the parameters survive any redirect on your own site.
  3. 3Watch GA4 Realtime for the first clicks and check source, medium and campaign.
  4. 4After a day, check that the sessions land in Paid Social rather than Paid Other or Unassigned.

Clicks from Meta also carry an fbclid, which is separate from your UTMs and used for Meta's own matching; our explainer on fbclid, _fbc and _fbp covers how it works. Many of those clicks open in Meta's in-app browser, which has its own effects on sessions and cookies, described in our guide to in-app browsers and tracking.

UTMs answer half the question

Well-tagged Meta traffic tells GA4 which ad drove a visit. It does not make Meta's reported conversions match GA4's, because the two use different attribution rules, a gap explained in why Meta Ads conversions do not match GA4. EndFrame captures the UTM values and the fbclid on arrival, stores them against the visitor, and sends conversions to the Meta Conversions API server-side, so both your reports and Meta's optimisation see the same leads.

Frequently asked questions

What does {{site_source_name}} return?

It returns a short code for the Meta app where the ad was shown. At the time of writing Meta documents fb for Facebook, ig for Instagram, msg for Messenger, an for Audience Network and th for Threads.

Why does my UTM campaign name not match the current campaign name?

Meta sets name-based parameters such as {{campaign.name}} and {{ad.name}} to the names used when the ad was first published. Renaming the campaign later does not change the value in the URL. To get a new value you have to publish a new campaign, ad set or ad.

Will editing URL parameters reset the learning phase?

It can. Meta's help centre says you can change URL parameters after publishing, but that doing so may cause the ad set to re-enter the learning phase. Set the parameters before launch, ideally in a saved template you reuse.

Does Meta add UTM parameters automatically?

Meta says some parameters may be added to ad traffic automatically, including a campaign source of Facebook or Instagram, a campaign medium of paid, and ad, ad set and campaign IDs. Your own values in the URL parameters field give you control over naming, so most advertisers still set them explicitly.

Try EndFrame

Add a server-side path for your conversions.

EndFrame collects events first-party and forwards conversions server-side to Meta, GA4, TikTok, and webhooks with event-ID deduplication — then credits each conversion to its campaign, with the visit-to-conversion path you can audit.

No credit card required

Keep reading