Overview

Server-side Google Tag Manager (sGTM) implementation for TikTok Events API allows you to send conversion events directly from your server to TikTok Ads. This setup offers several advantages over client-side tracking, including improved data reliability, better performance, and reduced impact from ad blockers.

This guide walks you through the complete process of setting up TikTok Events API through server-side Google Tag Manager, from creating a pixel to testing and verification.

The recommended approach is to implement both TikTok Pixel (client-side) and Events API (server-side) simultaneously. This dual-channel implementation maximizes event coverage and provides redundancy, ensuring your campaign performance remains protected even if one channel experiences issues.

Prerequisites

Before you begin this integration, ensure you have:

  • A functioning web & server container installed on your website
  • A server container created in your GTM account
  • A frontend tag (Google Analytics 4) sending events to your tagging server
  • Access to TikTok Ads Manager with permissions to access Events Manager

This implementation requires Google Tag Manager knowledge and appropriate access permissions. Make sure you have the necessary expertise or consult with a developer before proceeding.

Implementation Steps

Creating a TikTok Pixel

If you already have a TikTok pixel, you can skip to the next section. Otherwise, follow these steps to create a new pixel:

1

Access TikTok Ads Manager

Go to TikTok Ads Manager and log in to your account.

2

Navigate to Events Manager

Hover over “Tools” in the navigation bar, find “Management,” and click on “Events.”

3

Set Up Web Events

  1. Click on the “Manage” button under “Web Events”
  2. Click “Setup Web Events”
  3. Enter a pixel name
  4. Select “Events API” as the implementation method
  5. Click “Next”
4

Choose Integration Method

  1. Select “Automatically Set Up Web Events via Partner Platforms”
  1. Click “Next”
  2. Choose “Google Tag Manager Server-side”
  1. Click “Next”
5

Save Pixel Information

Your new pixel is now created. Make note of the Pixel ID displayed on the screen.

Getting Pixel ID & Events API Access Token

To configure the TikTok Events API template, you’ll need your Pixel ID and an API Access Token:

1

Access Pixel Settings

Navigate to Tools > Events > Web Events in TikTok Ads Manager, select your pixel, and go to the Settings tab.

2

Copy Pixel ID

At the top of the Settings page, you’ll find your Pixel ID. Copy and save this value.

3

Generate Access Token

  1. Scroll down to find the “Access Token” section
  1. Click “Generate Access Token”
  2. Copy and save the token that appears

Your credentials should look similar to these examples:

  • Pixel ID: CIB1R6JC77UCDSLJS0OG
  • Access Token: 00c350fde1xxxxxxxxxxxxxxxxxxxxxxxx1991af

Setting Up Server-Side Google Tag Manager

1

Install the TikTok Template

  1. In your GTM server container, navigate to Tags
  2. Click “New” to create a new tag
  3. Click the tag configuration area to select a tag type
  1. Search for “TikTok Events API (Official)” in the Community Template Gallery
  1. Click “Add to workspace” to install it

The template can only be applied to a Server container. Make sure your container type is set to “Server” before proceeding.

2

Configure the Event Settings

  1. Enter your Pixel ID and Access Token in their respective fields

You can create GTM variables for the Pixel ID and Access Token to reuse them across multiple tags. Click the ”+” sign next to each field to create or select variables.

  1. Select the Event type you want this tag to track
3

Set Up Advanced Matching

Advanced matching helps improve conversion tracking accuracy by sending hashed user identifiers:

  1. Configure Email, Phone, and External ID fields using GTM variables
  2. All identifiers are automatically hashed with SHA256 before being sent to TikTok

Implementing advanced matching early in the user journey significantly improves match quality and campaign performance.

Choose one of the following options to pass user information:

  • Extract from Common Event Schema: Use this when values are available in the GA4 common event schema
  • Use Custom Variables: Select specific variables for each field when data is available from other sources
4

Configure E-commerce Data

If you’re tracking product or purchase events, configure the e-commerce data section:

5

Set Up Deduplication

If you’re implementing both TikTok Pixel (client-side) and Events API (server-side), configure event deduplication:

  1. Select the appropriate event_id variable
  2. Ensure both Pixel and Events API implementations use the same event_id

Deduplication is critical when using both Pixel and Events API to avoid double-counting conversions and ensure accurate campaign reporting.

6

Configure Additional Settings

The template automatically collects server information like IP address and user agent. You can leave this section blank unless you need to override specific fields.

7

Set Up Trigger

  1. Click the Triggering area to select or create a trigger
  2. Configure a trigger that fires when the appropriate event is received
  1. For example, to track purchase events, create a trigger that activates when a purchase event is detected
  2. Click “Save” to complete the tag setup

Testing and Verification

1

Use Preview Mode

  1. Click “Preview” in your server container
  2. Trigger test events from your website
  3. Monitor the preview console to verify the Events API calls
  4. Look for a response containing {"code": 0, "message": "OK"} to confirm success
2

Use TikTok Test Events Tool

  1. In TikTok Events Manager, select your pixel
  2. Go to the “Test Events” tab
  3. Copy the test event code from Step 2 of the Test Server Events section
  4. Add this code to your TikTok Events API tag in the “Test Event Code” field
  5. Save the changes and trigger test events
  6. Check the Event Activity section to verify events are being received

Remember to remove the test event code after testing is complete before moving to production.

Troubleshooting

Frequently Asked Questions