You launch a TikTok ad campaign, but conversion data arrives with a 20-30% error. Budget goes to waste, optimization doesn't work. This is a typical situation when the pixel is set up hastily or server-side transmission is missing. We fix this, ensuring up to 99% accuracy even with ad blockers.
TikTok Pixel is a conversion tracking tool for TikTok advertising. We set it up so that every conversion is counted without duplicates, and ad campaigns are optimized for real purchases, registrations, or subscriptions. Without the pixel, you spend your budget blindly: up to 40% of conversions may go unnoticed due to ad blockers and browser errors. Server-side integration pays off even with a moderate ad budget due to data accuracy.
How to Set Up TikTok Pixel?
Step 1: Install the Base Code
Place the following code in the <head> of all site pages. Replace PIXEL_ID with your pixel ID from the ad account. We recommend using a tag manager (GTM) to simplify updates — this reduces the time for making changes by 2-3 times.
<script>
!function (w, d, t) {
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify",
"instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],
ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};
for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);
ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)
ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){
var i="https://analytics.tiktok.com/i18n/pixel/events.js";
ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,
ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");
o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;
var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};
ttq.load('PIXEL_ID');ttq.page();
}(window, document, 'ttq');
</script>
Step 2: Configure Standard Events
For an online store, four standard events are sufficient: ViewContent, AddToCart, InitiateCheckout, CompletePayment. Example code:
// View product
ttq.track('ViewContent', {
contents: [{ content_id: productId, content_name: productName }],
value: product.price,
currency: 'RUB'
});
// Purchase
ttq.track('CompletePayment', {
contents: orderItems.map(i => ({ content_id: i.productId, quantity: i.qty, price: i.price })),
value: orderTotal,
currency: 'RUB',
order_id: orderId
});
// Registration
ttq.track('CompleteRegistration', { value: 0, currency: 'RUB' });
For more accurate user matching, pass advanced matching via ttq.identify():
ttq.identify({
sha256_email: sha256(user.email.toLowerCase()),
sha256_phone_number: sha256(normalizePhone(user.phone))
});
Step 3: Connect the Server-Side Events API
The client-side pixel can lose 15-20% of events due to ad blockers or browser errors. The server-side Events API sends events directly from your backend, increasing reliability to 99%. Example in PHP (Laravel):
Http::withToken(env('TIKTOK_ACCESS_TOKEN'))
->post('https://business-api.tiktok.com/open_api/v1.3/event/track/', [
'pixel_code' => env('TIKTOK_PIXEL_ID'),
'event' => 'CompletePayment',
'timestamp' => time(),
'context' => [
'user' => [
'sha256_email' => hash('sha256', strtolower($user->email)),
'sha256_phone' => hash('sha256', normalizePhone($user->phone))
],
'page' => ['url' => $pageUrl]
],
'properties' => [
'contents' => $itemsArray,
'value' => $total / 100,
'currency' => 'RUB'
],
'event_id' => "purchase_{$orderId}"
]);
Important: pass event_id in both channels (client and server) — this allows TikTok to deduplicate events and avoid inflating conversions. In practice, this reduces data discrepancy from 30% to 2-3%. Losing 10% of conversions due to incorrect pixel setup can cost a business significant money.
Why Is the Server-Side Events API Critical for Tracking Accuracy?
The server-side Events API is 2-3 times more reliable than the client-side — it is not affected by ad blockers, JavaScript errors, or browser restrictions. Additionally, the server-side method allows passing extra data, such as exact order ID or internal user ID, which improves audience quality for retargeting. Without server-side transmission, up to 40% of purchases may remain untracked.
How to Avoid Data Discrepancies?
Data discrepancies arise from event duplication, ad blockers, or lack of deduplication. Main solutions:
- Pass a unique
event_idin both client and server pixels. - Use
ttq.identify()with advanced matching (email and phone in SHA256). - Ensure the pixel loads only once.
- Test with Pixel Helper and TikTok Ads testing mode.
These measures reduce discrepancies to 2-3%.
Typical Integration Errors
| Problem | Cause | Solution |
|---|---|---|
| No data in ad account | Pixel not installed or blocked | Check code via Pixel Helper extension |
| Conversion discrepancy > 20% | No deduplication or duplicate events | Pass event_id and ensure pixel loads once |
| Events not sending | Script error or conflict with other trackers | Open browser console and check JavaScript errors |
| Advanced matching not working | Incorrect hash (SHA256) or empty data | Ensure email/phone are normalized and hashed correctly |
What's Included in Turnkey Pixel Setup?
We perform the full cycle: from audit to documentation. Timeline — from 1 day to 1 week depending on complexity.
| Stage | Result |
|---|---|
| Audit of current tracking system | Identify issues with existing pixels and GTM |
| Base pixel installation | Correct code in <head> on all pages |
| Event setup (client + server) | All key events sent with deduplication |
| Testing | Verification via Pixel Helper and TikTok Ads testing mode |
| Documentation | Maintenance instructions, event list, data format description |
Cost is calculated individually. Factors: number of events, need for server-side integration, GTM presence, CMS complexity. Request an audit of your current tracking — we'll provide accurate estimates and timelines. Contact us for a consultation on your project; we'll help set up tracking that pays off from the first campaigns.
Experience: over 30 e-commerce projects, we guarantee correct data transmission and compliance with TikTok requirements.







