Meta Conversions API vs TikTok Events API
How Meta's Conversions API and TikTok's Events API differ, how to set up each one, and how to send the same purchase to both.
Meta Conversions API (CAPI) and TikTok Events API both let your server send conversion events straight to the ad platform, instead of relying only on a browser pixel. If you advertise on Facebook, Instagram or TikTok, you will likely want the one for each platform you use.
This guide compares the two APIs, walks through setup for each, and shows the ways to send the same event to both.
Why send events from the server?
A browser pixel only reports what the browser lets it send. A server-side API reports what your server knows happened, such as a paid order.
What limits browser pixels
Traditional tracking uses JavaScript pixels in the browser:
<!-- Facebook Pixel -->
<script>
fbq('track', 'Purchase', {value: 99.99, currency: 'USD'});
</script>
<!-- TikTok Pixel -->
<script>
ttq.track('CompletePayment', {value: 99.99, currency: 'USD'});
</script>
These pixels can be stopped or limited by:
- Ad blockers and privacy extensions
- Firefox and Brave tracking protection
- Safari’s Intelligent Tracking Prevention, which limits how long cookies last
- Scripts that fail to load, or pages that close before the pixel fires
Result: some purchases never reach the ad platform, and you can’t see which ones from the platform alone.
How the server-side route works
Server-side APIs send the event from your server, so browser extensions can’t stop it:
User Action → Your Server → Meta/TikTok API
↓
(not affected by browser blockers)
What it gives you:
- Events that don’t depend on the browser loading a script
- Control over exactly which fields you send
- A second source of events that the platform can deduplicate against the pixel
Server-side delivery fixes a lot, but it needs watching too. It can still break quietly, for example when an access token expires, so check the events received in each platform’s event tools regularly.
Meta Conversions API (CAPI)
What is Meta CAPI?
Meta Conversions API is Meta’s server-to-server route for conversion events. Your server sends events directly to Meta, alongside or instead of the browser pixel. See Meta’s Conversions API documentation.
Key features
| Feature | Description |
|---|---|
| Event types | Standard and custom events |
| Customer information | Email, phone, IP address, user agent and more; personal fields are SHA-256 hashed (Meta’s list) |
| Attribution | Set by the attribution setting on each ad set (Meta’s help page) |
| Deduplication | A pixel event and a CAPI event with the same event ID and event name are counted once (Meta’s deduplication guide) |
Meta CAPI event structure
{
"data": [{
"event_name": "Purchase",
"event_time": 1706613000,
"event_id": "order_12345_1706613000",
"user_data": {
"em": "e233d4a29013e9d87150c6237c6777bedf379ebf1acdc5d6126fec7e8bb74fb5",
"ph": "c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646",
"client_ip_address": "192.168.1.1",
"client_user_agent": "Mozilla/5.0..."
},
"custom_data": {
"value": 99.99,
"currency": "USD",
"content_ids": ["SKU-123"],
"content_type": "product",
"order_id": "ORDER-12345"
},
"action_source": "website"
}],
"access_token": "YOUR_ACCESS_TOKEN"
}
The em and ph values above are real SHA-256 hashes (64 hexadecimal characters) of customer@example.com and 1234567890. Meta lists how to normalise each field before hashing in its customer information parameters.
Setting up Meta CAPI
Step 1: Find your pixel (dataset) ID
- Open Meta Events Manager.
- Select the pixel (dataset) your ads optimise for.
- Copy its ID from the dataset’s settings.
Step 2: Generate an access token
- In Events Manager, select your pixel.
- Open Settings.
- Under Conversions API, choose Generate access token.
Step 3: Test events
Use the Test Events tool in Events Manager before going live:
curl -X POST "https://graph.facebook.com/v25.0/YOUR_PIXEL_ID/events" \
-H "Content-Type: application/json" \
-d '{
"data": [{
"event_name": "TestEvent",
"event_time": '$(date +%s)',
"user_data": {
"client_ip_address": "127.0.0.1",
"client_user_agent": "TestAgent"
},
"action_source": "website"
}],
"test_event_code": "TEST12345",
"access_token": "YOUR_ACCESS_TOKEN"
}'
Step 4: Production implementation
Option A: Direct API call
async function sendToMetaCAPI(event) {
const payload = {
data: [{
event_name: event.name,
event_time: Math.floor(Date.now() / 1000),
event_id: event.id,
user_data: {
em: hashSHA256(event.user.email),
ph: hashSHA256(event.user.phone),
client_ip_address: event.user.ip,
client_user_agent: event.user.userAgent,
},
custom_data: {
value: event.value,
currency: event.currency,
content_ids: event.productIds,
content_type: 'product',
},
action_source: 'website',
}],
access_token: process.env.META_ACCESS_TOKEN,
};
const response = await fetch(
`https://graph.facebook.com/v25.0/${process.env.META_PIXEL_ID}/events`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
}
);
return response.json();
}
Option B: Through a gateway such as Anacoic
A gateway takes one event from your site and sends it on to each connected platform. With Anacoic, Meta’s Conversions API works today. You send raw email and phone in user, and the gateway hashes them before sending:
// Send once; the gateway sends it on to Meta's Conversions API
await fetch('https://edge.anacoic.com/track', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Gateway-ID': 'YOUR_GATEWAY_ID',
},
body: JSON.stringify({
event_name: 'Purchase',
event_id: 'order_12345',
user: {
email: 'customer@example.com',
phone: '+1234567890',
},
custom_data: {
value: 99.99,
currency: 'USD',
content_ids: ['SKU-123'],
},
}),
});
The trade-off: you add a service between your site and Meta, in exchange for less code of your own to maintain.
TikTok Events API
What is TikTok Events API?
TikTok Events API is TikTok’s server-to-server route for conversion events. It works like Meta CAPI, with TikTok’s own event names and payload shape. See TikTok’s Events API documentation.
Key features
| Feature | Description |
|---|---|
| Event types | TikTok’s own standard events (CompletePayment, ClickButton and others) |
| Customer information | External ID, phone and email (SHA-256 hashed), plus the ttclid click ID and the _ttp cookie value |
| Attribution | Set in TikTok Ads Manager; check TikTok’s documentation for the current options |
| Deduplication | Send the same event_id from the pixel and the Events API |
| Event sources | Web and app events |
TikTok Events API structure
{
"event_source": "web",
"event_source_id": "YOUR_PIXEL_ID",
"data": [{
"event": "CompletePayment",
"event_time": 1706613000,
"event_id": "order_12345_1706613000",
"user": {
"external_id": "user_12345",
"phone": "c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646",
"email": "e233d4a29013e9d87150c6237c6777bedf379ebf1acdc5d6126fec7e8bb74fb5",
"ttp": "94e5d1c8-8d59-4a9c-9a7e-2c9e8f3d5b1a"
},
"properties": {
"value": 99.99,
"currency": "USD",
"content_id": "SKU-123",
"content_type": "product",
"order_id": "ORDER-12345"
}
}]
}
Setting up TikTok Events API
Step 1: Find your pixel ID
- Open TikTok Ads Manager.
- Go to Tools, then Events, then Web Events.
- Create or select your pixel and copy its ID.
Step 2: Get an access token
- In the same pixel’s settings, find the Events API section.
- Generate an access token.
- Store it on your server, never in browser code.
Step 3: Test events
curl -X POST "https://business-api.tiktok.com/open_api/v1.3/event/track/" \
-H "Access-Token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"event_source": "web",
"event_source_id": "YOUR_PIXEL_ID",
"data": [{
"event": "TestEvent",
"event_time": '$(date +%s)',
"user": {
"external_id": "test_user"
},
"properties": {
"value": 1.00,
"currency": "USD"
}
}]
}'
Step 4: Production implementation
Option A: Direct API call
async function sendToTiktokEventsAPI(event) {
const payload = {
event_source: 'web',
event_source_id: process.env.TIKTOK_PIXEL_ID,
data: [{
event: mapEventName(event.name), // Convert to TikTok event names
event_time: Math.floor(Date.now() / 1000),
event_id: event.id,
user: {
external_id: hashSHA256(event.user.id),
email: hashSHA256(event.user.email),
phone: hashSHA256(event.user.phone),
ttclid: event.user.ttclid, // click ID from the ttclid URL parameter
ttp: event.user.ttpCookie, // value of the _ttp cookie set by the TikTok pixel
},
properties: {
value: event.value,
currency: event.currency,
content_id: event.productId,
content_type: 'product',
},
}],
};
const response = await fetch(
'https://business-api.tiktok.com/open_api/v1.3/event/track/',
{
method: 'POST',
headers: {
'Access-Token': process.env.TIKTOK_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
}
);
return response.json();
}
// Map your events to TikTok event names
function mapEventName(name) {
const mapping = {
'Purchase': 'CompletePayment',
'AddToCart': 'AddToCart',
'PageView': 'ViewContent',
'InitiateCheckout': 'InitiateCheckout',
'Lead': 'SubmitForm',
};
return mapping[name] || 'CustomEvent';
}
Option B: Through a gateway such as Anacoic (beta for TikTok)
Anacoic’s gateway has a TikTok destination that maps standard event names to TikTok’s. It is in beta: not yet tried with a real ad account. If you use it, check the first deliveries in the gateway’s log and in TikTok Events Manager. The request is the same one you send for Meta:
// One request; the gateway sends it on to every connected destination
await fetch('https://edge.anacoic.com/track', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Gateway-ID': 'YOUR_GATEWAY_ID',
},
body: JSON.stringify({
event_name: 'Purchase',
event_id: 'order_12345',
user: {
email: 'customer@example.com',
phone: '+1234567890',
},
custom_data: {
value: 99.99,
currency: 'USD',
content_ids: ['SKU-123'],
},
}),
});
// Meta Conversions API: works today. TikTok Events API: in beta.
How do Meta CAPI and TikTok Events API compare?
Both APIs take a server-side event with hashed customer information and an event ID for deduplication. They differ mainly in event names, payload shape and the click identifiers they use.
Feature comparison
| Feature | Meta CAPI | TikTok Events API |
|---|---|---|
| Test events tool | Yes, in Events Manager | Yes, in Events Manager |
| Deduplication key | event_id + event name | event_id |
| Customer information object | user_data | user |
| Click identifier | fbc (from the fbclid URL parameter) | ttclid |
| Browser cookie identifier | fbp | ttp |
| Event value fields | custom_data | properties |
Rate limits and attribution options change over time. Check each platform’s documentation for the current values.
Event name mapping
| Standard event | Meta CAPI | TikTok Events API |
|---|---|---|
| Purchase | Purchase | CompletePayment |
| Add to cart | AddToCart | AddToCart |
| View content | ViewContent | ViewContent |
| Initiate checkout | InitiateCheckout | InitiateCheckout |
| Lead | Lead | SubmitForm |
| Search | Search | Search |
| Add payment info | AddPaymentInfo | AddPaymentInfo |
| Complete registration | CompleteRegistration | CompleteRegistration |
TikTok adds and renames standard events from time to time. Check TikTok’s list of supported events before you map yours.
Customer information fields
| Field | Meta CAPI | TikTok Events API | Format |
|---|---|---|---|
em | email | SHA-256 hashed | |
| Phone | ph | phone | SHA-256 hashed |
| IP address | client_ip_address | ip | Plain text |
| User agent | client_user_agent (required for website events) | user_agent | Plain text |
| External ID | external_id | external_id | SHA-256 hashed |
| Click ID | fbc | ttclid | Plain text |
Meta lists which fields are required in its customer information parameters. For TikTok, check the field list in TikTok’s Events API documentation. Sending more of the fields you legitimately have usually helps each platform match events to people.
How do you send events to both platforms?
You can call both APIs from your own server, or send one request to a gateway that calls them for you.
Option 1: Your own implementation
async function trackEvent(event) {
// Send to Meta
const metaPromise = sendToMetaCAPI(event);
// Send to TikTok
const tiktokPromise = sendToTiktokEventsAPI(event);
// Wait for both
const [metaResult, tiktokResult] = await Promise.allSettled([
metaPromise,
tiktokPromise,
]);
// Log results
console.log('Meta:', metaResult.status);
console.log('TikTok:', tiktokResult.status);
}
Pros:
- No extra service between you and the platforms
- Full control over every field and every retry
Cons:
- Two integrations to write and maintain
- Two sets of error handling and retry logic
- Two access tokens to watch for expiry
Option 2: A gateway such as Anacoic
Connect each destination once in the gateway, then send one request:
await fetch('https://edge.anacoic.com/track', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Gateway-ID': 'YOUR_GATEWAY_ID',
},
body: JSON.stringify({
event_name: 'Purchase',
event_id: 'order_12345',
user: {
email: 'customer@example.com',
phone: '+1234567890',
},
custom_data: {
value: 99.99,
currency: 'USD',
content_ids: ['SKU-123'],
},
}),
});
What the Anacoic gateway does with it:
- Sends it to Meta’s Conversions API (works today)
- Sends it to TikTok’s Events API if you connect TikTok (in beta: not yet tried with a real ad account)
- Maps standard event names to each platform’s names
- Hashes email and phone before they leave the gateway
- Retries failed deliveries
- Keeps a delivery log you can check
Pros: one request from your site, one place to see deliveries, and an alert when a destination keeps refusing its access token.
Cons: another service in the path, and TikTok delivery is still in beta. Google Ads is available on request; Snapchat, LinkedIn, Pinterest, Reddit, X and Microsoft are also in beta.
Best practices
1. Always include event IDs
The same event ID on the pixel event and the server event lets each platform count the conversion once:
const eventId = `${orderId}_${timestamp}`;
// Use same ID for both platforms
metaEvent.event_id = eventId;
tiktokEvent.event_id = eventId;
2. Hash personal information consistently
Both platforms expect SHA-256 of the trimmed, lowercased value:
function hashPII(value) {
return crypto
.createHash('sha256')
.update(value.trim().toLowerCase())
.digest('hex');
}
3. Pass the TikTok click ID (ttclid)
TikTok adds ttclid to the landing page URL when someone clicks an ad. Capture it and send it with later events:
// Capture on page load
const urlParams = new URLSearchParams(window.location.search);
const ttclid = urlParams.get('ttclid');
// Store it in your own first-party cookie
if (ttclid) {
document.cookie = `my_ttclid=${ttclid}; max-age=604800; path=/`; // 7 days
}
// Read it when sending events, and send it as user.ttclid
const storedTtclid = getCookie('my_ttclid');
Send the value of the _ttp cookie, which the TikTok pixel sets, separately as user.ttp.
4. Test before production
Meta: use Test Events in Events Manager.
TikTok: use Test Events in TikTok Events Manager.
5. Watch the match quality each platform reports
Meta: check Event Match Quality for each event in Events Manager.
TikTok: check the match quality TikTok shows for your pixel in Events Manager.
Compare each score with its own recent days. A sudden drop usually means a field stopped being sent.
To check either setup against your sales, compare the purchases each platform received with your store orders, day by day (why those numbers differ). Watch does this for Meta (early access), and the free tracking check shows which pixels load on your site.
Troubleshooting
Common Meta CAPI issues
| Issue | What to check |
|---|---|
| “Invalid token” | Regenerate the access token in Events Manager |
| “Event not received” | event_time is a Unix timestamp in seconds and not too old |
| Low Event Match Quality | Send more of the customer information fields you have |
| Duplicate events | The pixel and server events share the same event_id and event name |
Common TikTok Events API issues
| Issue | What to check |
|---|---|
| “Invalid access token” | Generate a new token for the pixel in TikTok Ads Manager |
| “Event rejected” | The event name is on TikTok’s list of supported events |
| Low match quality | Send ttclid, ttp and more customer information |
| Rate limit errors | Queue events and retry with backoff; see TikTok’s docs for current limits |
Which should you use?
Use the API for each platform you advertise on. The choice is less “Meta or TikTok” and more “how do you send to both”.
Use Meta CAPI if:
- You run Facebook or Instagram ads
- You want purchases counted even when the browser pixel is blocked
- You have in-store or offline conversions to send
Use TikTok Events API if:
- You run TikTok ads
- You want purchases counted even when the TikTok pixel is blocked
Use both if:
- You run ads on both platforms
Then pick how to send them:
- Your own code suits teams with engineering time who want no extra service in the path.
- A gateway suits teams who would rather send one request and check deliveries in one place. With Anacoic, Meta works today and TikTok is in beta.
The short version
Meta CAPI and TikTok Events API do the same job for their own platforms. They differ in:
- Event names (for example
PurchasevsCompletePayment) - Payload shape (
user_dataandcustom_datavsuserandproperties) - Click identifiers (
fbcvsttclid)
Either way: send the same event ID from the pixel and the server, hash personal fields the same way, and check the events received in each platform’s event tools regularly. Server-side delivery can break quietly, like a pixel can.
For more background, read the server-side tracking guide or see how Anacoic works.
Resources
- Meta Conversions API Documentation
- TikTok Events API Documentation
- Anacoic Meta CAPI Setup
- Anacoic TikTok Setup (beta)
Need help setting up server-side tracking? Talk to us or read our quickstart guide.