Skip to content

tiktok/gtm-template-eapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image

gtm-template-eapi

Pre-requisites

Before getting started, you should already have set up Google Tag Manager Server-side tagging. Specifically:

  1. A tagging server
  2. A frontend tag (gtag.js or Google Analytics 4) sending events to the tagging server
  3. 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.

Setup

1. Install the Template

You can find our pixel from Google Tag Manager Template Gallery. Click "Add to workspace" to install it into your workspace. f6e24f039e40cbd88fa593761d00cde9

Note that the template can only be applied to a Server container. Therefore, you need to ensure that the Container Type of your container is Server. 7bafae94ec6b319f2b5ac1abe51665b7

2. Create Pixel & Events API Access Token

You'll need a Pixel ID and an API Access Token to use this template. To create these, follow the steps below:

  1. Go to TikTok Ads Manager

  2. After logging in, hover over "Tools" on the navigation bar, and find "Management", then click on "Events" image

  3. Click on "Web Events"

  4. Click on "Setup Web Events", select "Events API", and click "Next"

  5. Select "Manually Set Up Events API" and click "Next" image

    image

  6. Click "Go to Settings" to return to the settings page of the Pixel you just created. image

  7. At the top, you will find your Pixel ID. Copy and save the Pixel ID image

  8. Scroll down to click "Generate Access Token". Copy and save the token information shown image image

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

3. Use the Template

Back on Google Tag Manager, create a new Tag, then select the template you just created. image image

3.1 Event Configuration

  1. 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) image

  2. 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 image

3.2 Advanced Matching

  1. 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.

image

  1. 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.

image

3.3 Product Info, Enhanced / Standard E-commerce

  1. 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.

  2. 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) image

  3. 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 image

3.4 Deduplication

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. image

3.5 Other Configurations

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. image

3.6 Choose a Trigger

Choose a GTM Trigger to associate with the tag, then click "Save". image

4. Test Server Tags

  1. Click "Preview" to test out the new Tag. You may need to trigger it from your gtag.js or GA4 installation. image

  2. 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. image

5. Verify Setup

  1. 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. image

  2. Fill in the "Test Event Code" field in the template. Then save the changes. image

  3. Repeat steps in section 4 "Test Server Tags" to trigger a test event.

  4. 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. image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages