Before getting started, you should already have set up Google Tag Manager Server-side tagging. Specifically:
- A tagging server
- A frontend tag (gtag.js or Google Analytics 4) sending events to the tagging server
- Triggers and variables configured in your server-side container. If you haven't completed this setup, please refer to Google's server-side tagging instructions here.
You can find our pixel from Google Tag Manager Template Gallery. Click "Add to workspace" to install it into your workspace.
You'll need a Pixel ID and an API Access Token to use this template. To create these, follow the steps below:
-
Go to TikTok Ads Manager
-
After logging in, hover over "Tools" on the navigation bar, and find "Management", then click on "Events"
-
Click on "Web Events"
-
Click on "Setup Web Events", select "Events API", and click "Next"
-
Click "Go to Settings" to return to the settings page of the Pixel you just created.
-
At the top, you will find your Pixel ID. Copy and save the Pixel ID
-
Scroll down to click "Generate Access Token". Copy and save the token information shown
Now, you should have both your Pixel ID and Access Token. For example, they should look like the following:
- Pixel ID: IDCEV44IRC77UE3S4LF95G
- Access Token: 00c350fde1xxxxxxxxxxxxxxxxxxxxxxxx1991af
Back on Google Tag Manager, create a new Tag, then select the template you just created.
-
Enter the Pixel ID and Access Token from the previous section. (Note: You could also make these into Variables for easier reuse across tags. Click on the "+" sign beside each box to select from your Variables)
-
Select an Event you'd like this tag to send. The Event should depend on what trigger you decide to associate with this tag. To learn more about TikTok's available event types, TikTok's Supported Pixel events, please visit our Business Help Center article here
- In the next section, you can configure sending Email, Phone, and External ID to TikTok. All Email, Phone, and External ID are hashed (with SHA256) before they're sent to TikTok in order to preserve anonymity. It is IMPORTANT to fill out Advanced Matching as much as you can. Without it, TikTok cannot measure the effectiveness of your ads. In the example below, two Variables defined by Google Tag Manager are used to fill out Email and Phone.
- You can choose to send us the SHA256-encrypted information, or you can choose to send us the plain Email, Phone, and External ID. If you choose this option, we will hash it for you before sending it to TikTok.
-
The following section is your product information. This is important if you're advertising a product sold on a site. Complete product information allows TikTok to do Shopping Ads, ROAS, and Value-based Optimization for you.
-
The easiest way to set this up is through Google Analytics Ecommerce Data Layers. Whether you're using gtag.js or GA4, Enhanced Ecommerce or Standard Ecommerce, as long as you're pushing product data to the datalayer, we can it pick up automatically. (To learn more about Ecommerce Data Layers, see Link1 Link2 Link3)
-
Alternatively, you can configure product data by filling them out manually. Select "Use Custom Data", and use your Variables to fill out the rest of the form. Single Content: Associate this event with one product. Multiple Contents: Associate this event with multiple products; the "contents" field must be filled with a JSON-encoded string of products. Order Info Only: Only post back "value" and "currency" information to TikTok
If you're also using the TikTok Pixel on your website, please configure Event ID to deduplicate web and server-to-server events. Learn more about Event Deduplication, visit our Business Help Center article here.
The tagging server will automatically fill in information in this section. Feel free to leave this section blank, unless you wish to override any field.
Choose a GTM Trigger to associate with the tag, then click "Save".
-
Click "Preview" to test out the new Tag. You may need to trigger it from your gtag.js or GA4 installation.
-
After triggering a Tag created with the template, you can see the Events API call in the Console. Specifically, you should be able to see the API response body. When the response contains {"code": 0, "message": "OK"}, it means the request was sent successful.
-
Get "Test Event Code" from Events Manager. Learn more instruction from this article. Go to Events Manager, click on "Web Events", then click the pixel to view the pixel detail page. Click on "Test Events" Tab. Follow instructions to copy the test event code.
-
Fill in the "Test Event Code" field in the template. Then save the changes.
-
Repeat steps in section 4 "Test Server Tags" to trigger a test event.
-
In a few minutes, if you set up the server tag correctly, your event will be received from TikTok and displayed in "Test Events" Tab! Fix the event payload issues if necessary.