Guide · Attribution

Lead Attribution: How to Track Every Lead Back to Its Campaign and Ad

How lead tracking works from click to closed deal: UTMs, click IDs, session matching, form capture and CRM revenue per ad. Plus first vs last click and a checklist.

Daniel Kalcher8 min read

Meta reports 48 leads, Google Ads 31, and your CRM has 62 inquiries with no recognizable source. Which ad brought which lead, and which of them later became a customer? That's the question lead attribution answers. This guide is for performance marketers, agencies and lead generation businesses. By the end you'll know how to attribute every lead to its campaign, ad set and ad, which building blocks have to work together, when first click and when last click is the right view, and why ad platform numbers never quite match your CRM.

What lead attribution has to deliver

Lead tracking means more than counting form submissions. For every inquiry you want to answer three questions:

  1. Where did the lead come from? Channel, campaign, ad set and ad.
  2. What happened to it? Qualified, meeting booked, deal won or lost, revenue.
  3. What did it cost? Ad spend per lead, per closed deal and relative to revenue.

The ad platforms only answer part of this. They see their own clicks and whatever their pixel captures on your website. They don't see what happens in your CRM, and they know nothing about ads on other networks. That's why your own attribution doesn't start in the ad account, but on your website, where click and lead meet.

The data chain from click to revenue

For a lead to end up with the right ad, five links have to hold. If one breaks, the lead shows up as "direct" or "unknown".

1. Tag the click

Every ad needs URL parameters that say where the visit came from. UTM parameters give you the readable view (utm_source, utm_campaign, utm_content), while click IDs such as gclid, fbclid, ttclid or li_fat_id identify the individual click for the platform. To attribute down to the ad level, dynamic parameters matter, such as {{ad.id}} in Meta or {creative} in Google Ads. Names change when someone renames a campaign, IDs stay stable. How to set this up is covered in the guide on clean campaign tracking.

2. Store the visit

UTMs and click IDs are only in the URL on the first page view. A tracking script has to read them during the visit and store them in a session, usually with first-party cookies. That's the only way the source survives when someone converts three pages later or on a second visit a week later.

3. Capture the lead

When the form is submitted, the lead has to be connected to the session. There are two ways:

  • Session ID in the form: A hidden field sends the session identifier along with the form data. This is the most precise match.
  • Matching on contact details: The tracking detects the email address or phone number in the form and stores it on the session. When the lead arrives later by webhook or from the CRM, it's found that way.

It gets tricky when the form sits in an iframe, runs on a different domain or leads into a checkout. How to connect funnel builders, booking tools and checkout pages is explained in the guide on cross-domain tracking for funnels and iframes.

4. Match the lead to the session

Now the lead is linked to its visit. Robust matching works in a fixed order: session ID first, then email address, then phone number. A long enough lookback period is important. In real estate or B2B, weeks can pass between the first click and the inquiry. And leads that can't be matched right away should be matched again later, because data doesn't always arrive in the right order.

5. Bring deals and revenue back

A lead is not a customer yet. Revenue happens later in your CRM or payment provider. For it to land with the right ad, the deal has to be traced back to the original lead via email address, phone number or an ID. Only then do you see cost per acquisition and ROAS per ad, and only then can you send closed deals back to Meta, Google Ads, TikTok or LinkedIn as offline conversions. How to measure real ROAS from there is covered in the guide on lead generation from click to closed deal.

An example

An insurance broker runs two Meta campaigns and one Google search campaign, 5,000 € per month in total.

Meta campaign AMeta campaign BGoogle Search
Leads per ad account412228
Leads attributed by click301824
Deals won254
Revenue3,000 €9,500 €6,800 €

Going by the ad account, campaign A is the winner. With your own attribution down to the deal, campaign B is clearly ahead: fewer leads, but more than twice as many closed deals. Without this chain, the budget would flow into the wrong campaign.

First click or last click for lead generation?

If someone comes back several times through different ads, the attribution model decides who gets the lead.

First-click attributionLast-click attribution
Lead goes tothe first clickthe last click before the inquiry
AnswersWhich campaign brings in new prospects?Which campaign triggers the inquiry?
FavorsProspecting, video, socialRetargeting, brand search, reminders
Good forBudget for acquiring new customersOptimizing the last steps of the funnel

A typical pattern in lead generation: someone sees a Meta ad, clicks, looks around and searches for your brand on Google three days later. With last click, Google brand search gets the lead, with first click the Meta campaign. If you only look at last click, you'll quickly cut the budget of the campaigns that created the demand in the first place.

Our recommendation: look at both views. If they're close, the journey is short and the decision is easy. If they differ a lot, campaigns at the start of the journey are doing more than last click shows. Models such as multi-touch attribution split the lead across several contacts, but they assume that every touchpoint is actually captured. In lead generation that's rarely the case, and two clear views are often more useful.

Why ad accounts and CRM never match

Even with perfect lead tracking, platform numbers will be higher than your own. The main reasons:

  • Views and engagements count too: Meta, Google and TikTok also credit themselves with leads after a plain view or an engagement without a click. Website tracking only sees clicks.
  • Double counting: If the same person saw ads on Meta and Google, both platforms count the lead.
  • Different attribution windows: Google Ads uses 30 days after the click by default, Meta 7 days.
  • Modeled conversions: Without consent, platforms partly fill their numbers with estimates.
  • Lost parameters: Redirects, cookie banners or iframes strip click IDs, and the lead doesn't show up in any account.

For the question "how many leads and customers did each campaign bring?", your own attribution is the reference, not the ad account. How to reconcile the numbers anyway is covered in the guide on attribution windows.

💡
A good health metric for your lead tracking: the share of paid leads without a source. If it stays above 10-15%, something is getting lost along the chain, usually at redirects, embedded forms or booking tools.

Lead tracking checklist

  1. Parameters in every ad

    All active ads carry UTMs with campaign, ad set and ad ID. Auto-tagging is on in Google Ads.
  2. Tracking on every page

    The tracking script runs on the landing page, form pages, thank-you pages and all funnel domains.
  3. Redirects tested

    A test visit with ?utm_source=test&gclid=test still shows the parameters after every redirect and after the cookie banner.
  4. Forms connected

    Every form passes on a session ID or an email address or phone number, including in iframes, funnel builders and booking tools.
  5. Test lead submitted

    One test lead per form shows up with channel, campaign and ad in your reporting.
  6. CRM connected

    Deals and payments are matched to the original lead automatically, not by hand in a spreadsheet.
  7. Model agreed

    The team knows whether you report by first click or last click, and the model doesn't change in the middle of an analysis.
  8. Signals sent back

    Leads and won deals go to the ad platforms via the Conversion API so they optimize for customers instead of form fills.
  9. Check weekly

    The share of leads without a source is reviewed regularly. If it jumps, something changed on the website, a form or the ads.

How LeadMetrics helps

LeadMetrics covers the whole chain from click to revenue (lead tracking & attribution):

  • One script for all channels: It captures sessions, visits and page views with their traffic source, meaning LeadMetrics' own ad parameters, UTMs and click IDs. Sessions last 90 days with consent and 1 day without.
  • Automatic matching: 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.
  • Form detection: Email and phone number from form fields are transmitted encrypted, including in single-page apps. For iframes, funnel builders and checkouts there are placeholders and redirects.
  • CRM and payments: Deals from HubSpot and Close and payments from Stripe, CopeCart and Digistore24 land with the right lead. You can connect other sources via Zapier, Make or your own webhooks.
  • Drill down to the ad: Dashboards show leads, deals, cost per acquisition, revenue and ROAS per channel, campaign, ad set and ad, with a switch between first click and last click. Each lead has a journey timeline and click history.
  • Conversion API: Leads, purchases and won deals go to Meta, Google Ads, TikTok and LinkedIn with value, hashed contact details and click IDs.

Ready for better tracking?

Try LeadMetrics free for 10 days and see which campaigns actually drive revenue.
Try free for 10 days

Frequently asked questions

Lead attribution assigns every lead to the channel, campaign, ad set and ad it came from. It relies on URL parameters at the click, a stored session on your website and a link between the form submission and that session.

Terms in this guide

All terms

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.

UTM 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.

CRM · Customer Relationship Management

A CRM (customer relationship management) is a system for managing contacts, leads, deals and all communication with prospects and customers in one place.

Offline Conversions · Reporting deals that happen off your website back to ad platforms

Offline conversions are conversions that don’t happen on your website – like a closed deal in your CRM – and are sent back to ad platforms like Meta.

Related articles

More guides

All guides