Back to All Guides

Every ad pound spent on TikTok should be measurable. Yet, many advertisers still run campaigns without proper tracking in place. That means wasted budget, missed sales, and retargeting audiences that are essentially blank slates.

In 2026, TikTok offers two powerful data collection methods: the TikTok Pixel (browser-side) and the Events API (server-side). Used together, they give you the most complete picture of your customer journey — and fuel TikTok's algorithm to find more buyers like your best customers.

This guide walks you through both tools from scratch: what they are, why they matter, and exactly how to set them up — even if you've never touched a tracking pixel before.

⚠️ Warning: Running Ads Without Tracking

Without TikTok Pixel or Events API, your ad campaigns run blind. You can't optimise for conversions, can't retarget visitors, and can't prove ROI. Setting up tracking is the single most impactful thing you can do before spending your first pound on TikTok ads.

1. What Is the TikTok Pixel?

TikTok Pixel setup dashboard

TikTok Pixel setup in TikTok Ads Manager — the starting point for conversion tracking.

The TikTok Pixel is a small snippet of JavaScript code you place on your website. When a visitor lands on your site after seeing or clicking a TikTok ad, the pixel fires and sends event data back to TikTok — things like page views, add-to-cart actions, purchases, and sign-ups.

Think of it as a bridge between your website and TikTok's ad platform. Without this bridge, TikTok has no idea what happens after someone clicks your ad.

What the TikTok Pixel Tracks

  • Page views — who visited your website and which pages they viewed
  • Button clicks — specific CTA clicks like "Add to Cart" or "Sign Up"
  • Form submissions — lead forms, newsletter sign-ups
  • Purchase events — completed orders with revenue values
  • Video views — how far visitors watched embedded videos
  • Custom events — any action you define as valuable
💡 Pro Tip

The TikTok Pixel also enables Custom Audiences — you can retarget anyone who visited your product page, added to cart but didn't buy, or completed a purchase (to create Lookalike Audiences). This alone can 3x your ROAS.

2. What Is the TikTok Events API?

TikTok Conversion API overview

The TikTok Events API (CAPI) sends conversion data directly from your server — bypassing browser limitations.

The TikTok Events API (also called Conversion API or CAPI) is the server-side equivalent of the browser pixel. Instead of sending event data from the visitor's browser, it sends data directly from your server to TikTok's servers.

Why does this matter? Because browser-based tracking is increasingly unreliable in 2026:

  • Ad blockers prevent the pixel from firing (estimated 42% of desktop users)
  • iOS 14+ and Safari's Intelligent Tracking Prevention (ITP) block 3rd-party cookies
  • Firefox blocks tracking scripts by default
  • Chrome's deprecation of 3rd-party cookies is now in full effect

The Events API bypasses all of these limitations because it runs on your server, not the user's browser. The result: more conversions tracked, better ROAS data, and smarter audience algorithms.

3. TikTok Pixel vs Events API: Which Is Better?

The honest answer: use both. They're complementary, not competing. Here's how they differ:

Feature TikTok Pixel (Browser) Events API (Server)
How it worksJavaScript in visitor's browserHTTP request from your server
Affected by ad blockersYes — blocked by ~42% usersNo — completely bypasses them
iOS 14+ / Safari ITPSignificantly impactedUnaffected
Setup difficultyEasy (copy/paste code)Moderate (developer needed)
Real-time dataYesNear real-time (seconds)
Data accuracy60–80% of actual conversions90–99% of actual conversions
Customer matchingCookie-based (degrading)1st-party data (email, phone)
Best used forPage events, click trackingPurchases, leads, offline events
Required for retargetingYes (primary)Supplementary
TikTok recommendationRequiredStrongly recommended for scale
📌 Best Practice 2026

Run both Pixel + Events API simultaneously with deduplication enabled. TikTok's algorithm uses all available signals to optimise delivery. Accounts using both see an average 19% improvement in cost per acquisition vs. Pixel-only setups.

🎯

Ready to Start Running TikTok Ads?

Set up your pixel correctly from day one AND claim up to $6,000 in FREE ad credits as a new advertiser.

Claim $6,000 FREE Credits → Start Tracking Right

New advertisers only · No promo code needed · Auto-activates at sign-up

4. TikTok Standard Events: What to Track & When

TikTok has 20 standard events that work out-of-the-box with their algorithm. Prioritise these events for your vertical:

Event Name Trigger When Best For Priority
PurchaseOrder confirmed / payment completedeCommerce, D2CHIGH
CompleteRegistrationUser signs up / creates accountSaaS, Apps, Lead GenHIGH
PlaceAnOrderCart checkout initiatedeCommerceHIGH
AddToCartItem added to shopping carteCommerce, RetailMED
InitiateCheckoutUser reaches checkout pageeCommerceMED
ViewContentProduct or content page viewedAll verticalsMED
AddPaymentInfoPayment details enteredeCommerceMED
SearchSite search performedeCommerce, MarketplaceLOW
ContactContact form submittedB2B, Service BusinessMED
SubscribeNewsletter or subscription signupMedia, SaaSLOW
ClickButtonKey CTA button clickedLead Gen, AppsLOW
SubmitFormAny form submittedB2B, Lead GenHIGH

5. How to Set Up the TikTok Pixel (Step-by-Step)

Setting up the TikTok Pixel takes under 10 minutes. Follow these steps exactly:

1
Create Your TikTok Pixel in Ads Manager

Log into TikTok Ads Manager, click Assets → Events → Web Events → Manage. Click "Create Pixel" and give it a name (e.g., "Main Website Pixel"). Choose your connection method — we recommend TikTok Pixel + Events API for maximum coverage.

2
Choose Your Installation Method
TikTok offers 3 ways to install the pixel:
  • Manual code — Copy the pixel base code and paste it into your site's <head> tag. Best for custom sites.
  • Partner integration — One-click install for Shopify, WooCommerce, Squarespace, Wix, BigCommerce, and more.
  • Google Tag Manager — Install via GTM without touching your site code. Recommended for marketers.
TikTok Pixel installation with Magento and Events API

TikTok Pixel installation options — partner integrations make setup fast for popular platforms.

3
Add the Pixel Base Code to Your Website

For manual installation, copy the pixel base code provided in TikTok Ads Manager and paste it in the <head> section of every page of your website, just before the closing </head> tag.

Pixel Base Code (example structure)
<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"];
    // ... TikTok pixel initialisation code
    ttq.load('YOUR_PIXEL_ID');
    ttq.page();
  }(window, document, 'ttq');
</script>

Replace YOUR_PIXEL_ID with the Pixel ID from your TikTok Ads Manager dashboard.

4
Set Up Automatic Events (Recommended)

Enable Automatic Events in the TikTok Pixel setup wizard. This tells TikTok to automatically detect and fire events like ViewContent, AddToCart, and Purchase without manual coding. It works especially well with Shopify, WooCommerce, and standard checkout flows.

For custom events, you'll need to manually add event code to specific pages (see Section 7 for code examples).

5
Verify Your Pixel is Firing Correctly

Install the TikTok Pixel Helper Chrome extension. Visit your website and check that the extension shows your pixel firing with green checkmarks. Alternatively, go to TikTok Ads Manager → Events → Web Events and look for "Recent Activity" — if data appears within 24 hours, you're set.

6. TikTok Pixel Setup for Shopify (2026)

Shopify advertisers have the easiest setup path thanks to TikTok's official Shopify integration. Here's how:

  • Go to your Shopify Admin → Apps → TikTok. If not installed, search for "TikTok" in the Shopify App Store and install the official TikTok app.
  • Connect your TikTok Ads Manager account by clicking "Connect" and authorising the app.
  • Select your existing pixel or create a new one — Shopify automatically injects the pixel base code across all pages.
  • Enable the Events API toggle (available in the TikTok Shopify app since 2023) — this adds server-side tracking automatically.
  • Test by adding a product to cart and completing a test order — check TikTok Pixel Helper to confirm Purchase event fires.
  • Enable Advanced Matching — this sends hashed customer email/phone data for better attribution. Shopify handles the hashing automatically.
💡 Shopify Tip

For Shopify Plus stores, also enable the Customer Events API in your Shopify checkout settings. This tracks checkout steps that the standard pixel can miss due to Shopify's sandboxed checkout.

7. How to Set Up TikTok Events API (Server-Side)

TikTok Events API setup for conversion tracking

Setting up TikTok Events API — server-side tracking captures conversions that pixel misses.

The Events API requires sending a POST request to TikTok's API endpoint every time a tracked event occurs. Here's the technical setup:

1
Get Your Access Token
In TikTok Ads Manager → Assets → Events → Web Events → Your Pixel → Settings. Click "Generate Access Token". Copy this token — you'll need it for API authentication. Keep it secret (treat it like a password).
2
Configure Deduplication (Critical Step)

When running Pixel + Events API together, you must include an event_id in both the pixel and API calls for the same event. TikTok uses this to deduplicate and count the event only once.

Pixel event with deduplication ID
// Browser pixel
ttq.track('Purchase', {
  content_id: 'PRODUCT_123',
  value: 49.99,
  currency: 'GBP'
}, {
  event_id: 'order_' + orderId  // unique ID for dedup
});
3
Send Events via API

Send a POST request to TikTok's Events API endpoint from your server after each conversion event:

Events API POST request (Node.js example)
const axios = require('axios');

await axios.post(
  'https://business-api.tiktok.com/open_api/v1.3/event/track/',
  {
    pixel_code: 'YOUR_PIXEL_ID',
    event: 'Purchase',
    event_time: Math.floor(Date.now() / 1000),
    event_id: 'order_' + orderId,  // matches pixel event_id
    user: {
      email: hashSHA256(customerEmail),  // always hash PII
      phone: hashSHA256(customerPhone),
      ip: req.ip,
      user_agent: req.headers['user-agent']
    },
    properties: {
      value: orderValue,
      currency: 'GBP',
      content_id: productId,
      content_type: 'product'
    }
  },
  {
    headers: {
      'Access-Token': 'YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    }
  }
);
4
Test Your Events API Integration

TikTok provides a Test Event Tool in Ads Manager → Events → Web Events → Test Events. Use this tool to send test events and verify they arrive correctly with all required parameters before going live.

8. Advanced Matching: Improve Attribution by 30%+

Advanced Matching allows you to send hashed first-party customer data (email, phone, name) with pixel events. TikTok uses this to match events to TikTok users more accurately — even when cookies are blocked.

📊 Impact of Advanced Matching

Advertisers who enable Advanced Matching see an average 30% increase in matched events, meaning 30% more conversions are correctly attributed to TikTok ads. This improves campaign optimisation significantly.

How to Enable Advanced Matching

  1. In TikTok Ads Manager → Events → Your Pixel → Settings → click "Advanced Matching"
  2. Enable the parameters you have available: email, phone, external ID
  3. In your pixel code, pass hashed values using SHA-256 (TikTok accepts pre-hashed data)
Advanced Matching with pixel — identify call
// Call this when user is logged in or has provided their email
ttq.identify({
  email: hashSHA256('customer@example.com'),
  phone_number: hashSHA256('+447911123456'),
  external_id: hashSHA256('user_id_12345')
});

9. Setting Up TikTok Retargeting Audiences

With pixel data flowing, you can create powerful custom audiences for retargeting. These are people who have already shown interest in your business — they convert at significantly higher rates than cold audiences.

Custom Audience Types (Pixel-Based)

🔍
Website Visitors

Anyone who visited your website in the last 7–180 days. Start with 30 days for warm audiences.

🛒
Add-to-Cart, No Purchase

High-intent shoppers who added items but didn't complete checkout. Show urgency-based ads.

📄
Specific Page Visitors

People who viewed specific product or category pages. Tailor creative to what they looked at.

Past Purchasers

Use for upsell, cross-sell, or to create Lookalike Audiences to find similar buyers.

🎯 Retargeting Pro Strategy

Create a Lookalike Audience based on your top purchasers (100+ events recommended). TikTok's algorithm uses the customer data from your pixel to find users with similar behaviour, interests, and demographics on TikTok. Lookalikes from purchasers typically outperform interest-based targeting by 2–4x.

10. Video Walkthrough: TikTok Pixel Setup

Watch this complete video tutorial for a visual, step-by-step walkthrough of setting up TikTok Pixel in your Ads Manager account:

How to Set Up the TikTok Pixel & View Dashboard
▶ How to Set Up the TikTok Pixel & View Dashboard

TikTok Pixel setup and dashboard walkthrough — official tutorial.

11. Common TikTok Pixel Problems & Fixes

Pixel is installed but not firing

Check: (1) Pixel ID is correct. (2) Code is in <head>, not <body>. (3) No CSP (Content Security Policy) blocking TikTok domains. (4) Use Pixel Helper Chrome extension to diagnose.

Duplicate events being counted

You're likely running both Pixel and Events API without deduplication. Add a unique event_id to both calls as described in Section 7. TikTok will then merge them into one event.

Conversions showing in Ads Manager but not attributing to campaigns

Check your attribution window settings. Default is 7-day click, 1-day view. If your purchase cycle is longer, extend to 14 or 28 days in campaign settings. Also verify the correct pixel is assigned to your campaigns.

Events API returning error 40002

Invalid parameter format. Ensure: (1) event_time is Unix timestamp in seconds, not milliseconds. (2) Email/phone values are SHA-256 hashed lowercase strings. (3) content_type is either "product" or "product_group".

Low match rate in Event Match Quality

Enable Advanced Matching (Section 8) and pass hashed email + phone with every purchase event. Also ensure you're sending user_agent and ip in Events API calls to improve device matching.

12. TikTok Pixel Best Practices for 2026

  • Use both Pixel + Events API — dual tracking gives you 90–99% conversion coverage vs 60–80% with pixel alone.
  • Enable deduplication — always pass a unique event_id in both pixel and API calls for the same event.
  • Fire events as early as possible — don't wait for third-party integrations. Fire Purchase events server-side the moment your server confirms the order.
  • Pass revenue values with currency — always include value and currency with purchase events for value-based optimisation.
  • Warm up with broad events first — before optimising for Purchase, collect at least 50 Purchase events. Start with ViewContent or AddToCart if volume is low.
  • Segment your audiences — don't just target "all website visitors". Create separate audiences by page type, recency (7d, 14d, 30d), and intent level.
  • Exclude converters from prospecting — add your past purchasers as an exclusion in cold audience campaigns to avoid wasting budget on existing customers.
  • Check Event Match Quality score weekly — TikTok gives each event a quality score. Aim for 7+ out of 10. Low scores mean poor attribution and optimisation.
  • Comply with privacy regulations — include TikTok in your cookie consent banner (GDPR/CCPA). Only fire events for consented users in cookie-dependent regions.
🚀

Now Set Up Your Pixel — AND Get $6,000 FREE

You now know exactly how to set up TikTok Pixel and Events API for maximum conversion tracking. The next step? Start running ads — and claim up to $6,000 in FREE ad credits as a new advertiser.

$6,000
Free Ad Credits
100%
Cashback Rate
0
Promo Code
10 min
To Activate
Claim My $6,000 FREE Ad Credits

Official TikTok For Business promotion · New advertisers only · Auto-activates at sign-up