Campaign Tracking with UTMs and Click IDs: Setup Guide
Set up clean campaign tracking: a UTM naming convention, dynamic parameters in Meta and Google Ads, click IDs, common mistakes and how to test it all.
Contents
You run ads on Meta, Google, TikTok or LinkedIn and want to know which campaign and which ad is driving your leads? Then everything depends on clean URL parameters. This guide is for performance marketers, agencies and lead-gen businesses. By the end, you'll know how to build a UTM naming convention, use dynamic parameters in Meta and Google Ads, which click IDs exist, where parameters typically get lost and how to check that everything works.
UTMs and click IDs: two different jobs
Campaign tracking relies on two kinds of URL parameters that complement each other:
- UTM parameters (
utm_source,utm_medium,utm_campaign,utm_content,utm_term) are set by you. They're readable and work in every tool – your own view of source, campaign and ad. - Click IDs are appended automatically by the ad platforms. They identify a single click, and only that platform can resolve them.
| Click ID | Platform | Requirement |
|---|---|---|
gclid | Google Ads | auto-tagging enabled in the account |
fbclid | Meta (Facebook, Instagram) | appended automatically |
ttclid | TikTok | appended when tracking is enabled |
li_fat_id | appended when conversion tracking is enabled |
You need UTMs for your reporting: which campaign brings leads at what cost? You need click IDs to send conversions back to the platform – for example a deal that closes in your CRM weeks after the click. If you only maintain one of the two, you either end up with gaps in your reporting or give the platform algorithms too few signals.
Set a UTM naming convention
The biggest problem with UTMs isn't the technology, it's inconsistency. "Facebook", "facebook", "fb" and "meta" show up as four different sources in every report. Define once how parameters are written – and stick to it.
Ground rules:
- Lowercase only, no spaces, no special characters. Separate words with underscores:
nurse_recruiting_q4. - Fixed values for
utm_sourceandutm_medium– for examplefacebook,instagram,google,tiktok,linkedinandpaid_social,cpc,email. utm_campaignfollows a fixed pattern such asgoal_product_period:leads_mortgage_2026q4.utm_contentdescribes the ad or variation,utm_termthe keyword or audience.- No personal data in the URL – no email addresses, no names.
Document the convention in a shared doc that everyone on your team and at your agency knows. For manual links (newsletters, partnerships, social posts) a generator helps: the free UTM builder creates links without typos.
Dynamic parameters in Meta and Google Ads
With dozens of ads, nobody maintains every URL by hand. Both major platforms can fill in values automatically at click time.
Meta Ads
In Ads Manager, at the ad level, enter this under "URL parameters":
utm_source=facebook&utm_medium=paid_social&utm_campaign={{campaign.name}}&utm_content={{ad.name}}&utm_term={{adset.name}}
Meta replaces the placeholders with the campaign, ad set and ad names when someone clicks. To separate Facebook from Instagram, you can use utm_source={{site_source_name}}. Watch out: if you rename a campaign, the UTM value changes from then on. {{campaign.id}}, {{adset.id}} and {{ad.id}} give you stable IDs.
Google Ads
First turn on auto-tagging so the gclid gets appended. The easiest way to add UTMs is the "Final URL suffix" at account or campaign level, using ValueTrack parameters:
utm_source=google&utm_medium=cpc&utm_campaign={campaignid}&utm_content={creative}&utm_term={keyword}
Google inserts IDs instead of names here. That's more robust, but your reporting needs to map the IDs back to campaigns. For iOS traffic, Google sometimes sets gbraid or wbraid instead of the gclid – one more reason to maintain UTMs as well.
TikTok and LinkedIn
TikTok and LinkedIn also offer their own placeholders for campaign and ad information. Above all, make sure the click IDs ttclid and li_fat_id don't get lost – the principle is the same as with the gclid and fbclid.
Common mistakes that lose parameters
Even with a perfect convention, parameters get lost between the click and the lead. These are the usual suspects:
- Redirects: A redirect from
httptohttps, fromwwwto the root domain, a missing trailing slash or a link shortener – any redirect can strip the query string. Test the final URL with parameters. - Cookie banners that reload the page: Some consent tools reload the page without parameters after the visitor makes a choice.
- Forms in iframes: An embedded form or funnel builder runs on a different domain and can't see the parent page's URL. The landing page's UTMs never reach the form.
- Switching domains: Landing page on
offer.com, form or checkout onshop.com– without cross-domain tracking, a new session without a source starts on the second domain. - UTMs on internal links: A banner on your own site tagged
utm_source=websiteoverwrites the original source. - Missing parameters on individual ads: New ads get duplicated or created from scratch and the URL parameters are missing.
How to check that everything works
Open the ad preview
In Meta and Google, click every ad variation in preview and check the URL in your browser: are the UTMs and click ID there, and were the placeholders replaced with real values?
Test your redirects
Open the destination URL with test parameters, for example
?utm_source=test&gclid=test123, also withoutwwwand withhttp. Are the parameters still in the address bar after every redirect?Walk through the cookie banner
Repeat the test once accepting and once declining. The parameters must not disappear on either path.
Submit a test lead
Fill out the form – including the one in the iframe or funnel builder – and check in your CRM or tracking tool whether source, campaign and click ID are stored with the lead.
Repeat regularly
Check the share of leads without a source every week. If it suddenly jumps, something changed on your website, form or ads.
How leads get attributed to their source
UTMs and click IDs are only in the URL on the first page view. But leads often convert later: on a subpage, on a second visit or days later by phone. To keep the source, you need three steps:
- Capture: On the visit, UTMs and click IDs are read and stored, typically in first-party cookies.
- Link: When a form is submitted, the lead has to be connected to that visit – through a session ID sent along with the form, or through the email address or phone number.
- Assign credit: If a lead had several visits from different sources, the attribution model decides. With first-click attribution the first touch gets the credit, with last-click attribution the last one.
An example: a prospect clicks a Meta ad on Monday, comes back via Google search on Thursday and books a consultation. With first click, the lead goes to Meta; with last click, to Google. Both views are valid – what matters is that both visits were captured with their parameters in the first place.
How LeadMetrics helps
LeadMetrics handles capturing and matching for you (Lead Tracking):
- One tracking script captures sessions, visits and page views including the traffic source – LeadMetrics' own ad parameters, UTMs and click IDs.
- Leads are matched to their session by session ID, email address or phone number, up to 90 days back. Unmatched leads are re-checked every hour.
- For iframes and funnel builders there are placeholders like
{{LM_SESS}}for hidden fields and__LM_SESS__for checkout links, plus redirects with?email=andlmetrics.attribute(). - Multi Domain Tracking keeps the session together when visitors move between your domains.
- In the dashboards you switch between first click and last click. For each lead you see the journey timeline and click history.
- The stored click IDs (
fbc/fbp,gclid,ttclid,li_fat_id) are sent along with leads, deals and payments to Meta, Google Ads, TikTok and LinkedIn via the Conversion API.
Ready for better tracking?
Frequently asked questions
Terms in this guide
All termsUTM Parameters
UTM parameters are tags added to a URL (e.g. utm_source, utm_campaign) that tell analytics tools which source and campaign a visitor came from.
gclid · Google Click Identifier
The gclid (Google Click Identifier) is a unique ID that Google Ads appends to the landing page URL on every ad click so conversions can be tied to that click.
fbclid · Facebook Click Identifier
The fbclid (Facebook Click Identifier) is an ID Meta appends to links from Facebook and Instagram so conversions can be attributed to the original click.
Cross-Domain Tracking
Cross-domain tracking follows a visitor across multiple domains as one session, for example from your website through a funnel to the checkout.
Attribution · Assigning conversions to marketing channels
Attribution assigns leads, purchases and revenue to the channels, campaigns and ads that drove them – the basis for every budget decision you make.
First-Click Attribution · The attribution model that credits the first contact
First-click attribution gives 100% of the credit for a conversion to the first touchpoint – the channel through which a user found you for the first time.
Last-Click Attribution · The attribution model that credits the last contact
Last-click attribution gives 100% of the credit for a conversion to the last touchpoint before it – the click that led directly to the lead or purchase.
First-Party Cookies
First-party cookies are set by the domain you are currently visiting. They store things like logins, shopping carts or tracking IDs for that same website.
Related articles
- From CRM Lead to Real Conversion: No More Flying Blind in Performance MarketingHow CRM/AdSync makes the true value of your campaigns visible – and why it's the game-changer for data-driven growth.
- Client-Side vs. Server-Side Tracking: Why One-Code Tracking Is the Next StepPrivacy, page speed, and conversion tracking compared – and why LeadMetrics' One-Code Tracking unites both worlds.
More guides
All guidesMeasure Real ROAS in Lead Generation: From Click to Closed Deal
How to measure real ROAS in lead generation: attribute CRM revenue to campaigns, read CPL, CPA and ROAS correctly and send deal values back to Meta and others.
Read guideSocial Media KPIs for Lead Generation: Which Metrics Matter
The key social media metrics for lead campaigns on Meta, Instagram, TikTok and LinkedIn: from reach and CTR to cost per lead, cost per acquisition and ROAS.
Read guide