tiktok-pixel-via-gtm-integration

Description

In this example we'll need to set up GTM custom variables, triggers and tags. This will allow us submitting the required data to TikTok analytics.

Bare in mind, this is an example of the TikTok pixel set up and your final set up might differ.

As an example, we'll be creating Event UUIDS custom variable. Let's visit Variables section in the GTM and click to create a new variable. The final result for the Event UUIDS variable should look like this:

In this case we:

  • Named the new variable as Event UUIDS
  • Chose the Variable type to be Data Layer Variable
  • Data Layer Variable Name is eventUUIDS

The most important part here is the Data Layer Variable Name, since this piece of data will be coming from our app and so we need to enter this key correctly.

Other variables should be created using the same principle:

Variable name Data Layer Variable Name
Amount amount
Wallet type walletType
Email email
Phone phone
Deposits count depositsCount

We also need to create a couple constant variables. These will be used the same way as the variables in the previous section.

Currency

Please make sure to replace 'EUR' currency with your own.

Contents

Please copy the JavaScript snippet below, as the one from screenshots is added just for display purposes.

function () {
  var eventUUIDS = {{Event UUIDS}};

  if (!eventUUIDS || !eventUUIDS.length) {
   return []; 
  }

  return eventUUIDS.map(function(eventUUID) { return { content_id: eventUUID } });
}

TikTok pixel ID

Please make sure to add your own Snapchat pixel ID.

The triggers we'll be implementing: Bets (main wallet), FTD (First time deposit), Subsequent deposit, Registration finished.

The most important parts are:

Let's implement these triggers according to the screenshots:

Now we should have all variables, constants and triggers created.

Now we'll need to create tags, which includes pixel base, Complete payment, Complete Registration, Initiate Checkout and Subscribe tags.

TikTok provides quite a comprehensive guide on how to create pixel base tag in GTM here: https://ads.tiktok.com/help/article/get-started-google-tag-manager?lang=en.

To integrate TikTok pixel tags, we'll use TikTok Pixel (by tiktok) template and some examples of final tag setups can be found below.

Here we used Custom HTML tag and copied the TikTok base code from the TikTok account. Please make sure to check that correct TikTok pixel ID is used in the ttq.load function. In our case, we added TikTok Pixel ID constant, which was created in previous step.

  • tiktok-pixel-via-gtm-integration.txt
  • Last modified: 2024/04/29 11:40
  • by evaldas-luksys