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.
For iframes, funnel builders and checkout pages, clean UTMs alone aren't enough. How to pass the session along is covered in the guide on cross-domain tracking for funnels and iframes.
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 the chain continues to the closed deal in your CRM is shown in the guide on lead attribution.
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 is the Google Click ID that Google Ads adds to your URL on every ad click, e.g. ?gclid=EAIaIQobChMI... What it means, why it is missing and how to use it.
fbclid ยท Facebook Click Identifier
The fbclid is the Facebook Click ID Meta adds to links from Facebook and Instagram, e.g. ?fbclid=IwAR2... What it means, whether you can remove it and how it is used.
Cross-Domain Tracking
Cross-domain tracking keeps one visitor session across several domains, e.g. website, funnel and checkout. Why cookies break and how to set it up in 5 steps.
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
- Performance Max for Lead Generation: How to Rein In Display Leads with Channel PrioritizationSince October 2026, Performance Max lets you set the Display Network and Search partners to low priority and cap their budget. How channel prioritization works and how to use it for better leads.
- Conversion APIs for Lead Generation: Meta, Google, TikTok and LinkedIn ComparedAll major ad platforms now accept leads and deals server-side, but each one differently. Match keys, click IDs, lead events, time limits and deduplication for Meta, Google Ads, TikTok and LinkedIn at a glance, as of October 2026.
- Meta Attribution in 2026: What Engage-Through Means and Why Conversions Are MissingSince March 2026, Meta only counts link clicks as clicks, while likes and saves count as engage-through. Two view windows are gone, too. What changed and how to read your numbers correctly.
- Google Data Manager API and Enhanced Conversions for Leads: What Changed in 2026Since June 15, 2026, the Google Ads API no longer accepts new offline conversion import integrations. What the Data Manager API is, how enhanced conversions for leads work and what to do now.
- 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: Differences, Pros and Cons for Lead GenerationClient-side vs server-side tracking: how both work, how they differ on ad blockers, cookies, privacy and data quality, and why lead gen setups combine the two.
More guides
All guidesCross-Domain Tracking for Funnels, Iframes and Checkouts: Don't Lose a Single Lead
Why leads from Heyflow, Perspective, Typeform, ClickFunnels, Calendly or Digistore24 lose their source, and how to pass the session across domains, iframes and checkouts.
Read guideHow to Improve Meta Event Match Quality: What Data to Send
How to improve Event Match Quality in Meta: which customer data counts, how to normalize and hash it, and how fbc, fbp and event_id help your score.
Read guideClient Reporting for Agencies: How to Automate Marketing Reports for Lead Generation
Which KPIs belong in a client report for lead campaigns, how to structure a monthly report and how to automate data collection and delivery. With template and checklist.
Read guide