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.
On this page
- What a Conversion API does
- Which events matter in lead gen
- What to send with each event
- Event data
- Customer data and hashing
- Click IDs and cookies
- The event ID for deduplication
- Platforms compared
- Setting up the Meta Conversions API
- Google Ads via the Data Manager API
- Setting up the TikTok Events API
- Setting up the LinkedIn Conversions API
- Improving match quality
- Common problems and solutions
- How to do it with TSO
- Sources
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.
| Stage | When | Meta | Google Ads | |
|---|---|---|---|---|
| Lead | Form submitted | Lead | "Lead" action | type LEAD |
| Qualified lead | Sales confirms fit | custom event or CRM stage | separate action | QUALIFIED_LEAD |
| Meeting | First call booked | Schedule | separate action | BOOK_APPOINTMENT |
| Closed deal | Deal won | Purchase or CRM stage | separate action with value | PURCHASE |
Three rules:
- 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.
- 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.
- 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
| Parameter | Meaning | Example |
|---|---|---|
| Event name | A stage from your list | Lead |
| Timestamp | When it happened, not when you send it | Unix time in seconds (LinkedIn: milliseconds) |
| Source | Website, CRM, phone | Meta: action_source: website |
| Page | URL where the event happened | https://example.com/thank-you |
| Value and currency | Always together | 1500, 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.
| Field | Meta | Google Ads | |
|---|---|---|---|
| lowercase, trimmed, hashed | lowercase; for Gmail no dots or + suffix, hashed | lowercase, no spaces, hashed | |
| Phone | digits with country code, hashed | E.164 with +, hashed | from API version 202611, digits without +, hashed |
| Name | hashed | first and last name hashed | as a pair, plain or hashed |
| IP and user agent | plain text | plain text | IPv4 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
_fbccookie, plus the_fbpbrowser ID. - Google Ads: gclid, on iOS sometimes gbraid or wbraid.
- TikTok: ttclid from the URL and the
_ttpcookie. - 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.
- Create the ID: Generate a random ID, such as a UUID, when the form is submitted.
- Give it to the pixel: Meta
eventID, TikTokevent_id, LinkedIn Insight Tagevent_id. - Send it from the server: Submit the same ID with the form and include it in the server event (Meta
event_id, LinkedIneventId). - 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
| Meta | Google Ads | TikTok | ||
|---|---|---|---|---|
| Interface | Conversions API | Data Manager API | Events API | Conversions API |
| Target | Dataset (pixel) | Conversion action | Pixel | Conversion rule |
| Avoiding duplicates | event name + event_id | transaction ID | event + event_id | separate rule + eventId |
| Click ID | fbc / fbp | gclid, gbraid, wbraid | ttclid, _ttp | li_fat_id |
| Max. age | 7 days | 90 days (gclid), 63 days (customer data only) | send promptly | 90 days |
| Testing | Test Events with test_event_code | validateOnly | Test Events | Payload Builder, no test mode |
| Lead form ID | lead_id | n/a | n/a | lead (URN) |
Setting up the Meta Conversions API
- Pick the dataset: In Events Manager, use your pixel's dataset and generate a Conversions API access token in its settings.
- Define the events: The stages from your list, named exactly as in the pixel.
- Build the server event:
event_name,event_time,action_source,event_source_url,event_idanduser_datawith hashed contact details plusclient_ip_address,client_user_agent,fbcandfbp. Up to 1,000 events fit in one request. - Test: Use the
test_event_codefrom the Test Events tool. According to Using the API, live events should show in Events Manager within about 20 minutes. - 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 Ads via the Data Manager API
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.
- 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.
- 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.
- Store the gclid: Save gclid, gbraid or wbraid with the lead on the first visit.
- Send: For each conversion, the target action, timestamp, click ID, hashed customer data, value, currency, transaction ID and the consent signals
adUserDataandadPersonalization(the Consent object covers the Digital Markets Act settings). - Test: The Google Ads offline conversions guide recommends
validateOnly: trueto 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
- Pixel and token: In TikTok Events Manager, select the pixel and generate an Events API access token in its settings.
- Map the events: Use a TikTok standard event for each stage, with the same name in pixel and server.
- Send the data: Event, timestamp,
event_id, page, hashed email, phone and external ID, ttclid,_ttp, IP and user agent. - Test: Use a test code from the Test Events view in Events Manager.
- 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
- Create a conversion rule: In Campaign Manager, create a rule using the Conversions API method with a fitting type such as
LEADorQUALIFIED_LEAD. - Associate campaigns: LinkedIn's Conversions API docs state that conversions only count for campaigns associated with the rule.
- Send the data: Timestamp in milliseconds, value,
eventIdand 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. - Deduplicate with the Insight Tag: A separate rule for the Insight Tag, the same
eventIdon both routes. - 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:
- More identifiers: Email and phone, plus name if you have it. For CRM stages, these carry the match on their own.
- 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.
- Normalize carefully: Wrong formats cause poor scores more often than missing data.
- 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
| Problem | Cause | Solution |
|---|---|---|
| Conversions counted twice | Pixel and server send no event ID, different IDs or different names | Create one ID in the browser, pass it to pixel and server, use identical names |
| Meta rejects the whole request | One event is older than seven days | Send promptly, drop stale events before sending |
| Low Event Match Quality | Only IP and user agent, or badly normalized data | Add email, phone, fbc and fbp, check normalization |
| Google: click too old | gclid older than 90 days | Upload more often or send an earlier stage |
| Google counts leads twice | Google tag and import count the same stage in two primary actions | One primary action per stage, same transaction ID |
| No conversions in LinkedIn | Rule not associated with campaigns or no valid identifier | Associate campaigns, send email or li_fat_id |
| Closed deals don't match | Click ID and contact details from the first visit missing on the deal | Store 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
- Best Practices - Conversions API, Meta for Developers
- Handling Duplicate Pixel and Conversions API Events, Meta for Developers
- Customer Information Parameters, Meta for Developers
- Server Event Parameters, Meta for Developers
- Using the API - Conversions API, Meta for Developers
- Conversions API for CRM integration, Meta for Developers
- About enhanced conversions for leads, Google Ads Help
- Offline conversion imports FAQs, Google Ads Help
- Google Ads offline conversions, Google for Developers
- Format user data, Google for Developers
- Consent, Google for Developers
- About Events API, TikTok Business Help Center
- How to set up matching events with Events API, TikTok Business Help Center
- About Event Deduplication, TikTok Business Help Center
- Conversions API, LinkedIn / Microsoft Learn
- Conversions API Schema, LinkedIn / Microsoft Learn
- Deduplication, LinkedIn / Microsoft Learn
How TSO helps
- Conversion APILeads, meetings and deals go server-side to seven ad platforms, deduplicated with the pixel. So their algorithms optimize for real customers.
- Privacy & consentThree privacy modes, automatic detection of your cookie banner, and per platform you decide which data leaves. Hosted in Germany.
- Lead formsLeads from Meta Instant Forms and LinkedIn Lead Gen Forms land in TSO automatically. Their lead ID goes back to the platform with every later conversion.
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
Daniel is CTO and leads the technology behind tracking, attribution and conversion APIs at TSO.