Skip to content
Guides · Tracking

How to set up a Conversion API for lead gen: Meta, Google Ads, TikTok and LinkedIn

Set up Conversion APIs for Meta, Google Ads, TikTok and LinkedIn: which events and data to send, how deduplication works and how to test before you scale.

Daniel Kalcher14 min read

This guide is for anyone who generates leads on Meta, Google Ads, TikTok or LinkedIn and wants to send conversions to those platforms from the server, whether you build it yourself, run a server-side tag manager or use a tool. You'll learn which events and data to send, how to avoid double counting and how to confirm everything arrives correctly.

The focus is lead generation, where the form fill is only the start. The real gain comes from telling the platform which leads turned into meetings and customers.

What a Conversion API does

A pixel reports conversions from the browser. It loses events to ad blockers, declined cookies, browsers with tracking prevention and everything that happens after the visit. A meeting in your calendar or a deal marked won in your CRM never reaches the pixel.

A Conversion API is the second route: your server sends the event straight to the platform. Meta's Conversions API best practices explicitly recommend using both routes and sending the same events through each. TikTok says the same in About Events API, and LinkedIn in its deduplication docs.

For lead gen, the server route has a second benefit that often matters more than recovered browser events: it carries your later sales stages back to the platform. That is how the algorithm learns which leads are worth paying for. The guide on how to optimize for qualified leads goes deeper.

Which events matter in lead gen

Decide up front which stages you'll send. Each stage is its own event (in Google Ads and LinkedIn, its own conversion action or conversion rule). Keep the list short: a few clean events beat twenty half-finished ones.

StageWhenMetaGoogle AdsLinkedIn
LeadForm submittedLead"Lead" actiontype LEAD
Qualified leadSales confirms fitcustom event or CRM stageseparate actionQUALIFIED_LEAD
MeetingFirst call bookedScheduleseparate actionBOOK_APPOINTMENT
Closed dealDeal wonPurchase or CRM stageseparate action with valuePURCHASE

Three rules:

  1. One name per stage: Use the same event name everywhere, in the pixel and on the server. Meta and TikTok deduplicate on the name as well as the ID.
  2. Only send values you trust: Send a value with currency for closed deals. For earlier stages, an estimated lead value works if you can back it up. The lead value calculator helps.
  3. Don't optimize twice: If the lead came from the platform's own form (Meta Instant Forms, LinkedIn Lead Gen Forms), the platform has already counted it. Send only the later stages, with the platform's lead ID.

What to send with each event

Every server event has four parts: event data, customer data, browser signals and an event ID. Miss one and the event is rejected, left unmatched or counted twice.

Event data

ParameterMeaningExample
Event nameA stage from your listLead
TimestampWhen it happened, not when you send itUnix time in seconds (LinkedIn: milliseconds)
SourceWebsite, CRM, phoneMeta: action_source: website
PageURL where the event happenedhttps://example.com/thank-you
Value and currencyAlways together1500, EUR

According to Meta's Server Event Parameters, a single event older than seven days makes Meta reject the entire request. Send promptly and filter out stale events first.

Customer data and hashing

Customer data is what lets a platform tie an event to a person. Platforms expect it normalized and hashed with SHA-256. Normalizing means trimming spaces, lowercasing and writing phone numbers with the country code. A value normalized the wrong way produces a different hash and matches nobody.

FieldMetaGoogle AdsLinkedIn
Emaillowercase, trimmed, hashedlowercase; for Gmail no dots or + suffix, hashedlowercase, no spaces, hashed
Phonedigits with country code, hashedE.164 with +, hashedfrom API version 202611, digits without +, hashed
Namehashedfirst and last name hashedas a pair, plain or hashed
IP and user agentplain textplain textIPv4 plain or hashed

Sources: Meta's Customer Information Parameters, Google's Format user data and LinkedIn's Conversions API Schema. TikTok's How to set up matching events with Events API requires email, phone and external ID to be hashed.

Keep in mind that hashing is not anonymization. The platform compares the hash with its own user data; that is the whole point of sending it. The legal side is covered in the guide on GDPR-compliant ad tracking.

Click IDs and cookies

Click IDs link an event to the specific ad click. They arrive in the landing page URL and have to be stored on the first visit, ideally with the lead in your CRM. If you only look for them when the deal closes, they're gone.

  • Meta: fbclid from the URL, stored as the _fbc cookie, plus the _fbp browser ID.
  • Google Ads: gclid, on iOS sometimes gbraid or wbraid.
  • TikTok: ttclid from the URL and the _ttp cookie.
  • LinkedIn: li_fat_id, which LinkedIn only appends once you enable enhanced conversion tracking with first-party cookies in Campaign Manager.

The event ID for deduplication

When the pixel and the server both report an event, the platform needs a way to recognize them as one. That's the event ID: a unique string you create in the browser, hand to the pixel and pass on to your server.

  1. Create the ID: Generate a random ID, such as a UUID, when the form is submitted.
  2. Give it to the pixel: Meta eventID, TikTok event_id, LinkedIn Insight Tag event_id.
  3. Send it from the server: Submit the same ID with the form and include it in the server event (Meta event_id, LinkedIn eventId).
  4. Match the name: Meta and TikTok compare event ID and event name together.

Per Handling Duplicate Pixel and Conversions API Events, Meta deduplicates events with the same ID received within 48 hours. TikTok's About Event Deduplication describes a window from five minutes to 48 hours, keeping the event that arrived first. LinkedIn needs a separate conversion rule for the Insight Tag and for the Conversions API, and when both carry the same eventId it counts only the Insight Tag event.

Later stages from your CRM have no browser event. Give each stage of each person a stable ID instead, so a resend never counts twice.

Platforms compared

MetaGoogle AdsTikTokLinkedIn
InterfaceConversions APIData Manager APIEvents APIConversions API
TargetDataset (pixel)Conversion actionPixelConversion rule
Avoiding duplicatesevent name + event_idtransaction IDevent + event_idseparate rule + eventId
Click IDfbc / fbpgclid, gbraid, wbraidttclid, _ttpli_fat_id
Max. age7 days90 days (gclid), 63 days (customer data only)send promptly90 days
TestingTest Events with test_event_codevalidateOnlyTest EventsPayload Builder, no test mode
Lead form IDlead_idn/an/alead (URN)

Setting up the Meta Conversions API

  1. Pick the dataset: In Events Manager, use your pixel's dataset and generate a Conversions API access token in its settings.
  2. Define the events: The stages from your list, named exactly as in the pixel.
  3. Build the server event: event_name, event_time, action_source, event_source_url, event_id and user_data with hashed contact details plus client_ip_address, client_user_agent, fbc and fbp. Up to 1,000 events fit in one request.
  4. Test: Use the test_event_code from the Test Events tool. According to Using the API, live events should show in Events Manager within about 20 minutes.
  5. Check: Review deduplication and Event Match Quality per event in Events Manager.

Leads from Instant Forms have their own route: the Conversions API for CRM integration. You store Meta's lead ID and send every later stage with it. The Conversion Leads performance goal builds on this. Meta's requirements include at least 200 leads a month, at least one upload per day, and a target stage reached within 28 days of the lead at a rate between 1 and 40 percent.

Google combines two signals. A gclid reports the click, enhanced conversions for leads add hashed customer data. About enhanced conversions for leads advises including the gclid whenever you have it. Since 15 June 2026, offline conversion imports and enhanced conversions for leads uploads go through the Data Manager API and are blocked in the Google Ads API.

  1. Create the conversion action: Under Goals → Conversions, create an "Import from clicks" action for each stage. Turn on enhanced conversions for leads and accept the customer data terms.
  2. Capture customer data on the site: The Google tag captures hashed contact details from the form so Google can match the later import. Without that tag, the gclid is required.
  3. Store the gclid: Save gclid, gbraid or wbraid with the lead on the first visit.
  4. Send: For each conversion, the target action, timestamp, click ID, hashed customer data, value, currency, transaction ID and the consent signals adUserData and adPersonalization (the Consent object covers the Digital Markets Act settings).
  5. Test: The Google Ads offline conversions guide recommends validateOnly: true to check payloads without sending production data. Diagnostics then show whether Google processed a conversion.

Mind the time limits: per the Offline conversion imports FAQs, Google keeps the gclid for only 90 days, and conversions with hashed customer data are accepted up to 63 days. If your sales cycle is longer, send an earlier stage that falls inside that window, such as the qualified lead. Our use case on offline conversions for Google Ads shows the day-to-day setup.

If the Google tag already counts the lead on your website, don't count the same stage again in a second action used for bidding. Pick one primary action per stage.

Setting up the TikTok Events API

  1. Pixel and token: In TikTok Events Manager, select the pixel and generate an Events API access token in its settings.
  2. Map the events: Use a TikTok standard event for each stage, with the same name in pixel and server.
  3. Send the data: Event, timestamp, event_id, page, hashed email, phone and external ID, ttclid, _ttp, IP and user agent.
  4. Test: Use a test code from the Test Events view in Events Manager.
  5. Check deduplication: Pixel and server must both send the event_id, or TikTok counts twice.

TikTok doesn't mandate specific match keys but asks you to send every one you have. Note that _ttp only exists when the pixel runs on the page too.

Setting up the LinkedIn Conversions API

  1. Create a conversion rule: In Campaign Manager, create a rule using the Conversions API method with a fitting type such as LEAD or QUALIFIED_LEAD.
  2. Associate campaigns: LinkedIn's Conversions API docs state that conversions only count for campaigns associated with the rule.
  3. Send the data: Timestamp in milliseconds, value, eventId and at least one identifier: hashed email, li_fat_id, IP address, first and last name as a pair, or the lead ID of a Lead Gen Form. An external ID only matches alongside one of these.
  4. Deduplicate with the Insight Tag: A separate rule for the Insight Tag, the same eventId on both routes.
  5. Verify: Both rules appear in the conversion breakdown. When deduplication works, the Insight Tag rule usually shows the higher count.

LinkedIn accepts events up to 90 days after the conversion and has no test mode of its own. Start with a handful of events and read the API responses: 201 means accepted, 400 names the field that failed.

Improving match quality

Only matched events count for attribution and optimization, as both Meta and LinkedIn state. Meta shows this as Event Match Quality, scored out of 10. To raise it:

  1. More identifiers: Email and phone, plus name if you have it. For CRM stages, these carry the match on their own.
  2. Pass browser signals: IP, user agent and cookies from the visit where the person converted. That means storing them server-side when the form comes in.
  3. Normalize carefully: Wrong formats cause poor scores more often than missing data.
  4. Merge people: Give a closed deal the contact details and click IDs from the original form. Your system has to know that the lead and the customer are the same person.

Say you report a won deal with only the work email from your CRM, but the person clicked the ad while logged in with a personal address. The platform finds no match. Add the phone number and the fbclid from the first visit, and the match works anyway.

Common problems and solutions

ProblemCauseSolution
Conversions counted twicePixel and server send no event ID, different IDs or different namesCreate one ID in the browser, pass it to pixel and server, use identical names
Meta rejects the whole requestOne event is older than seven daysSend promptly, drop stale events before sending
Low Event Match QualityOnly IP and user agent, or badly normalized dataAdd email, phone, fbc and fbp, check normalization
Google: click too oldgclid older than 90 daysUpload more often or send an earlier stage
Google counts leads twiceGoogle tag and import count the same stage in two primary actionsOne primary action per stage, same transaction ID
No conversions in LinkedInRule not associated with campaigns or no valid identifierAssociate campaigns, send email or li_fat_id
Closed deals don't matchClick ID and contact details from the first visit missing on the dealStore click IDs with the lead in your CRM and send them with the deal

How to do it with TSO

If you'd rather not build this yourself: TSO sends leads and later stages through Conversion APIs to Meta, Google Ads (Data Manager API, enhanced conversions for leads), TikTok and LinkedIn. Microsoft Ads, Snapchat and ChatGPT Ads are supported too, though manual tests against the live platforms are still open for those.

  • One event ID: Pixel and server send the same ID, and the TSO script can load the pixels for you.
  • CRM stages: Deals and payments from webhooks, the API or Stripe go out as their own events, and to Meta as CRM stages as well.
  • Lead forms: The lead ID from Meta Instant Forms and LinkedIn Lead Gen Forms travels with every later conversion of that person (lead forms).
  • Control: Delivery through a queue with retries, a delivery log per destination with reasons, and test mode for Meta, Google and TikTok.

On privacy, to be clear: TSO stores contact details in plain text and hashes them only when sending. By default, IP address and user agent go to the Conversion APIs even without consent. You can switch that off per destination, along with other field groups (privacy). Attribution covers clicks only, not views.

Sources

How TSO helps

Frequently asked questions

Do I still need the pixel if I use a Conversion API?

Meta, TikTok and LinkedIn all recommend running both. The pixel adds browser signals such as cookies, the server adds events the browser loses and stages from your CRM. With a shared event ID, each event is counted once.

Which events should a lead gen business send through the Conversion API?

At least the lead. Then the stages that mean money to you, such as qualified lead, booked meeting and closed deal with a value. One event per stage, with clear names.

Do I have to hash email addresses before sending them?

Yes. Meta, Google, TikTok and LinkedIn expect email and phone as SHA-256 hashes, normalized to their rules first. IP address, user agent and click IDs are sent in plain text.

How old can a conversion be when I upload it?

Seven days at most for Meta, 90 days for LinkedIn. Google Ads accepts conversions with a gclid up to 90 days after the click, and conversions with only hashed customer data up to 63 days.

What is a good Event Match Quality score?

Meta scores events out of 10, and higher is better. Meta doesn't publish fixed thresholds, but Events Manager shows which parameters are missing.

Terms in this guide

Related articles

Written by
Daniel KalcherCTO

Daniel is CTO and leads the technology behind tracking, attribution and conversion APIs at TSO.

More guides

All guides →

From the guide to clean measurement.

Set up TSO with us in a demo or request beta access.