Set up a TikTok pixel
Create or pick your TikTok ad account's pixel in Settings, install it on your site, see the events it receives and send events from your server.
A TikTok Sales campaign, and a Leads campaign that sends people to your website, optimizes for an event your TikTok pixel reports. On a TikTok brand, Koast lists the ad account's pixels in Settings, creates new ones, gives you the code to install, and shows which events each pixel receives.
Before you start
- Connect the TikTok ad account first. See Connect a TikTok ad account.
- Switch to the TikTok brand. The Pixel tab in Settings shows the pixels of the brand you're in.
Pick or create a pixel
Open Settings, then Pixel.
If the ad account has more than one pixel, pick the one you want from the list. Koast starts on a pixel that's receiving events.
To add a pixel, select Create pixel, type a name, for example "Main website", and select Create. The pixel is created in your TikTok ad account.
Next to the pixel's name, a dot shows its state: Receiving events, No recent activity or No events yet, then the pixel code. Open events manager opens the pixel in TikTok Events Manager, and Refresh reads the pixels and counts again.
Install it on your site
On the Setup tab, under Install this pixel, select Copy and paste the code inside the <head> of every page you want to track. TikTok Events Manager may show a newer version of the code. Both work with this pixel.
See which events arrive
The Events tab lists each event the pixel received over the last 7, 14 or 30 days, in UTC, with what it's defined as in TikTok and the counts from the Browser, from your Server and in Total. TikTok can take up to 30 minutes to report new events. To test events live or see diagnostics, open the pixel in TikTok Events Manager.
Send events from your server
The Server-side tab walks you through TikTok's Events API. Your server sends events straight to TikTok, next to the browser pixel. Koast doesn't receive them and doesn't store your token.
Get an access token. In TikTok Events Manager, open the pixel, go to Settings and choose Generate Access Token under Events API. TikTok shows the token once, so store it on your server.
Send events from your server. Post each event to TikTok's event endpoint with the token in the
Access-Tokenheader. The tab has a sample request already filled in for this pixel, and lists TikTok's standard event names, such asCompletePayment,AddToCartandSubmitForm.Deduplicate browser and server events. If your site reports the same action from the browser pixel and from your server, send the same
event_idin both, for example the order number. TikTok then counts one conversion instead of two. The tab has the browser call to add to that page, after the pixel code.Check that events arrive. Open the Events tab. Events your server sent are counted in the Server column, up to 30 minutes after they're sent.
The Events tab still counts both copies of a deduplicated event. TikTok removes the duplicate when it attributes conversions.
Use it in a campaign
In the campaign's Assets & Tracking settings, pick the pixel and the conversion event the ad set optimizes for. A Sales ad set takes any of TikTok's standard events, and a Leads ad set that sends people to your website takes Submit Form only. If the event you picked isn't on your pixel yet, Koast says so before launching: create the event in TikTok Events Manager, then select REFRESH ASSETS.