TikTok Conversions API via server-side GTM: step-by-step
TikTok's pixel has the same problems as Meta's. Here's how to set up TikTok CAPI through your existing sGTM container.
If you’ve already set up Meta CAPI through server-side GTM, you know the drill. Client-side pixels miss data. Server-side APIs recover it. TikTok is no different. The TikTok pixel has the exact same vulnerabilities as every other browser-based tracking script, and TikTok’s Conversions API (called Events API, but I’ll stick with CAPI since that’s what everyone actually calls it) solves the exact same problems.
I set up TikTok CAPI for a DTC brand last month. Their pixel was reporting 47 conversions per week. After enabling CAPI, the matched events jumped to 71. That’s a 51% increase in visible conversions. Their cost per acquisition dropped on paper immediately because TikTok’s algorithm could finally see what was actually happening.
The good news: if you already have a server-side GTM container running, this takes about an hour. Maybe two if you’re meticulous about testing.
Why TikTok’s pixel is losing data
The reasons are identical to what I covered in my Meta CAPI setup guide, so I’ll keep this brief.
Ad blockers kill the TikTok pixel. uBlock Origin and similar tools block requests to analytics.tiktok.com by default. About a third of desktop users never generate a pixel event on your site, no matter how perfectly you’ve implemented it.
Safari’s ITP truncates cookies. TikTok’s _ttp cookie, which the pixel uses for user matching, gets capped at 7 days when set via JavaScript. A user who clicks your TikTok ad, browses your site, and comes back 8 days later to buy looks like a brand new user to TikTok. Your attribution model breaks.
Consent banners block it. If you’re running proper consent management in Europe, users who decline marketing cookies never trigger the pixel. CAPI lets you send conversion data server-side with hashed user identifiers, which can operate under different legal bases depending on your setup and legal counsel’s interpretation.
Network and loading failures. TikTok’s pixel script is heavy. On slow connections or when users navigate away quickly, the script doesn’t finish loading. The event never fires. This is especially common on mobile, which is ironic given that TikTok’s audience is overwhelmingly mobile.
What TikTok CAPI gives you
CAPI sends event data from your server directly to TikTok’s servers. The browser isn’t involved. The benefits are straightforward:
- Better match rates. You can send hashed email, phone number, and other identifiers that the pixel can’t always capture. TikTok uses these to match events to users with higher confidence.
- More complete conversion data. Events that the pixel missed get captured server-side.
- Better ad optimization. TikTok’s algorithm makes smarter bidding decisions when it can see more conversions. This is the real payoff. Better data in means better optimization out.
- Longer attribution windows. Server-set cookies persist longer than JavaScript-set cookies, so your attribution windows actually work as intended.
Prerequisites
Before you start, make sure you have these in place:
-
A running sGTM container. If you don’t have one yet, read my guide on why server-side tagging isn’t optional and set that up first. You need the container deployed and processing events before you can add TikTok to it.
-
TikTok Events Manager access. You need admin access to the TikTok Business Center that owns your ad account. If you’re an agency, make sure the client has granted you the right permissions.
-
TikTok pixel already installed and firing. CAPI supplements the pixel. It doesn’t replace it. Your pixel should be live and tracking at least PageView events. If you haven’t set up the pixel yet, do that first.
-
Your GA4 client configured in sGTM. Your server container needs to be receiving events from your web container. The TikTok server-side tag will use the same event stream.
Step 1: Generate a TikTok access token
Go to TikTok Events Manager. Select your pixel. Click on “Settings” and scroll down to “Events API.”
Click “Generate Access Token.” Copy this token immediately and store it somewhere secure. You’ll need it in a moment, and TikTok won’t show it again. If you lose it, you’ll need to generate a new one.
A few notes on the token:
- It doesn’t expire, but you can revoke and regenerate it anytime.
- Keep it out of your codebase. Store it as an environment variable or in your sGTM container’s secret storage.
- Each pixel has its own token. If you’re tracking multiple properties, you’ll need separate tokens.
Step 2: Add the TikTok tag template in sGTM
Open your sGTM container in GTM. Go to Templates > Search Gallery > search for “TikTok.” You’re looking for the official TikTok Events API tag template. It’s published by TikTok and has a blue verified badge.
Import it into your container. If you’ve done this for Meta’s CAPI tag, the process is identical.
Once imported, go to Tags > New > and select the TikTok Events API tag type.
Step 3: Configure the TikTok tag
Here’s where it gets specific. In the tag configuration:
Access Token: Paste the token from Step 1. I recommend storing this as a constant variable in sGTM rather than hardcoding it directly in the tag. Create a variable called TikTok Access Token, set it as a constant, and reference it. This way, if you have multiple TikTok tags, you only update the token in one place.
Pixel ID: Your TikTok pixel ID. Find it in Events Manager under your pixel’s settings. It’s a numeric string, something like CP1234567890.
Event Name: This is where event mapping happens. You need to tell the tag which sGTM event corresponds to which TikTok event. I’ll cover the mapping in the next section.
User Data Parameters: This is where match quality lives or dies. Send as much user data as you can:
email(hashed with SHA-256)phone_number(hashed, including country code)external_id(your own user ID, hashed)ttp(the TikTok click ID from the_ttpcookie)ip(the user’s IP address)user_agent(the user’s browser user agent)
IP and user agent are automatically available in sGTM through built-in variables. For email and phone, you’ll need to push them into the data layer when available (usually at checkout or login) and pass them through to your server container.
Struggling with match rates or event mapping?I'll review your sGTM setup and make sure TikTok CAPI is capturing everything it should.
Book a Free Audit →Step 4: Map your events
TikTok uses its own event naming convention. Here’s how the standard ecommerce events map:
| Your sGTM Event | TikTok Event Name | Notes |
|---|---|---|
| page_view | PageView | Basic pageview |
| view_item | ViewContent | Product page views |
| add_to_cart | AddToCart | Include item value |
| begin_checkout | InitiateCheckout | Start of checkout flow |
| purchase | CompletePayment | The money event |
| generate_lead / form_submit | SubmitForm | Lead gen forms |
| search | Search | Site search |
For each event you want to track, create a separate TikTok tag in sGTM (or use a single tag with a lookup table variable that maps event names). I prefer separate tags because it makes debugging much easier. When something breaks, you know exactly which tag to look at.
For CompletePayment, make sure you include:
value(the transaction amount)currency(ISO 4217, like “USD” or “EUR”)content_type(set to “product”)contents(array of product objects withcontent_id,content_name,quantity,price)
These parameters feed TikTok’s value-based optimization. Without them, TikTok can see that a conversion happened but can’t optimize for higher-value conversions.
Step 5: Event deduplication
This is the part people get wrong, and it causes real problems. If both your pixel and CAPI send the same event, TikTok counts it twice unless you deduplicate.
The principle is identical to what I described in the Meta CAPI guide: both the pixel and the server-side tag need to send the same event_id for each event instance.
Here’s how to implement it:
-
In your web GTM container, generate a unique
event_idfor each event. I use a custom JavaScript variable that creates a UUID:function() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0; return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); } -
Push this
event_idin your data layer with each event. -
Pass it through to your sGTM container as an event parameter.
-
In your TikTok pixel (client-side), include the same
event_idin the pixel call:ttq.track('CompletePayment', { event_id: 'your-uuid-here' }). -
In your sGTM TikTok tag, map the
event_idparameter from the incoming event.
TikTok uses this event_id to match the pixel event and the CAPI event. If they share the same event_id, TikTok keeps one and discards the duplicate. If they don’t, both count, and your conversion numbers double.
I’ve seen accounts where someone set up CAPI without deduplication and then couldn’t figure out why their reported conversions doubled overnight. It took them weeks to notice because “more conversions” looks like good news until you realize your actual performance hasn’t changed.
Step 6: Set up triggers
For each TikTok tag, set up the corresponding trigger in sGTM. The triggers should match the event names your web container sends to the server container.
If you’re using the GA4 client in sGTM (which you probably are), the events arrive with the names you defined in your web GTM container. Create custom event triggers for each:
- Trigger: Custom Event, Event Name equals
page_view→ fires the PageView TikTok tag - Trigger: Custom Event, Event Name equals
purchase→ fires the CompletePayment TikTok tag - And so on for each event
Step 7: Testing
Testing TikTok CAPI involves three layers, and you need to check all three. This is where your debugging skills really matter.
Layer 1: sGTM Preview Mode. Open your sGTM container’s preview mode. Navigate through your site and trigger events. Verify that the TikTok tags fire and that the outgoing request contains the correct event name, parameters, and user data.
Layer 2: TikTok Events Manager. Go to Events Manager and click on your pixel. Switch to the “Test Events” tab. You should see events arriving with a source of “Server” or “API” alongside the browser pixel events. If you only see pixel events, your CAPI setup isn’t working.
Layer 3: Match quality. In Events Manager, TikTok shows a “Match Quality” score for each event. This ranges from 1 to 10. You want at least a 6. Below that, TikTok can’t reliably match your events to users, which defeats the purpose. The score improves as you send more user data parameters (email, phone, ttp, etc.).
Check deduplication specifically. Fire a test event on your site and watch Events Manager. You should see one event, not two. If you see two events with different event IDs, your deduplication is broken.
Common pitfalls
The _ttp cookie isn’t reaching sGTM. The TikTok click identifier lives in the _ttp cookie. Your web GTM container needs to read this cookie and pass it to the server container as an event parameter. Without it, TikTok can’t match the server event back to the ad click. Create a 1st Party Cookie variable in your web container that reads _ttp, add it to your GA4 event tag as a parameter, and map it in your server container.
Hashing user data twice. The sGTM TikTok tag template hashes user data automatically. If you’re already hashing email and phone before sending them to the server container, you’ll double-hash them, and TikTok won’t be able to match anything. Send unhashed data to your server container and let the tag template handle the hashing.
Currency format mismatches. TikTok expects ISO 4217 currency codes. Sending “dollars” or ”$” instead of “USD” will cause the value to be rejected. This is a quiet failure. The event registers, but the value doesn’t.
Missing content parameters on CompletePayment. If you send a CompletePayment event without contents, value, and currency, TikTok accepts the event but can’t use it for value-based optimization. You’re leaving performance on the table.
Consent mode integration. If you’re using Google Consent Mode, remember that your sGTM tags also need consent configuration. The TikTok tag should respect the same consent signals as your pixel. Don’t bypass consent server-side just because you can. That’s not how compliance works.
What to expect after enabling CAPI
In my experience across multiple accounts, here’s the typical impact:
- 15-50% more matched conversions visible in Events Manager, depending on your audience’s ad blocker and browser usage.
- Match quality scores improving from 3-4 (pixel only) to 7-8 (pixel + CAPI with good user data).
- CPA decreasing over 2-4 weeks as TikTok’s algorithm adjusts to seeing more complete conversion data.
- Better lookalike audiences because TikTok has more conversion events to model from.
The first week after enabling CAPI, your numbers will look strange. Conversion counts will jump. Don’t panic and don’t make campaign changes based on the first few days. Give TikTok’s algorithm 2-3 weeks to recalibrate.
Wrapping up
TikTok CAPI through sGTM is one of the highest-ROI tracking improvements you can make if you’re already running TikTok ads. The setup builds on infrastructure you’ve already built for Meta and GA4. The same server container handles everything. Once you’ve done it for one platform, each additional platform takes a fraction of the time.
If you’re running TikTok ads without CAPI in 2026, you’re optimizing blind. Your pixel is missing a significant chunk of your conversions, and TikTok’s algorithm is making bidding decisions based on incomplete information. Fix it. It’s an hour of work that pays for itself immediately.
Artem Reiter
Web Analytics Consultant