Integrate Google Tag Manager


How to setup Google Tag Manager

Here you find a step-by-step guide for setting up Google Tag Manager in combination with TRUENDO.

Step 1

Create a ‘Custom HTML’ Tag named TRUENDO Cookie Control and add the following code.

  1. Go to Tags.
  2. Click on New.
  3. Click on Tag Configuration and select Custom HTML.
  4. Name it TRUENDO
  5. Add the following code to the HTML field:

     1<script>
     2function TruendoCookieControlCallback(cookieObj) {
     3    if (cookieObj.preferences) {
     4        dataLayer.push({'event':'truendo_cc_preferences'});
     5    }
     6    if (cookieObj.marketing) {
     7        dataLayer.push({'event':'truendo_cc_marketing'});
     8    }
     9    if (cookieObj.statistics) {
    10        dataLayer.push({'event':'truendo_cc_statistics'});
    11    }
    12    if (cookieObj.social_content){
    13        dataLayer.push({'event':'truendo_cc_social_content'});
    14    }
    15    if (cookieObj.social_sharing) {
    16        dataLayer.push({'event':'truendo_cc_social_sharing'});
    17    }    
    18}
    19
    20<!-- TRUENDO Privacy Center -->
    21<script async="" id="truendoPrivacyPanel" type="text/javascript" src="https://cdn.truendo.com/pc/app.pid.js" data-siteid="YOU WEBSITE ID"></script>
    22<!-- End TREUNDO Privacy Center -->
    23
    24</script>
    25

    Note: You need to add the TRUENDO integration script in here instead of the <head> if you want to call TRUENDO via Tag Manager.
    DONT FORGET TO CHANGE THE SITE ID TO YOURS WHEN COPYING THIS SCRIPT.

  6. Tick Support document.write on.

  7. Click on Triggering and add All Pages and press Save.

Step 2

We now have to create variable that connects to the TRUENDO cookie truendo_cc.

  1. Go to Variables.
  2. Click on New.
  3. Name the Variable TruendoCookie
  4. Click on Variable Configuration and select 1st-Party Cookie.
  5. Write truendo_cc in the Cookie Name.
  6. Tick URI-deicode cookie and press Save.
Step 3

Now we have to make sure each Trigger that is not have an addtional condition to only fire when the category is set to on.

  1. Go to Triggers.
  2. Click on a trigger then edit and set This trigger fires on to Some Custom Events or Some Pages if it is not so already.
  3. Then set the condition to: TruendoCookie > contains > "[category]":true and press Save.

    Example:

    TruendoCookie > contains > "statistics":true

  4. Do points 1-3 for every trigger in the list.

Step 4

Now you have to set up the triggers for the tags. This means creating one trigger for every category (preferences, marketing, statistics, social_content and social_sharing). One Custom Event Trigger for each category.

You can do like so:

  1. Go to Triggers.
  2. Click on New.
  3. Click on Trigger Configuration and select Custom Event
  4. Name your trigger according to the category and configure the event as follows:
The Custom Event looks as follows:

Name: truendo_[category]
Event Name: truendo_cc_[category]
This trigger fires on: All Custom Events

Example:

Name: truendo_statistics
Event Name: truendo_cc_statistics
This trigger fires on: All Custom Events

Note: These triggers do not need the conditions of Step 3.

Step 5

The last step is applying these triggers to the other tags (E.g. Google Analytics, Hotjar, Outbrain, etc.) you want to control. To do this add the Custom Event trigger of the proper category to the trigger section.

Make sure that the TRUENDO trigger is the only trigger in the tag!