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:

    <script>
    function TruendoCookieControlCallback(cookieObj) {
        if (cookieObj.preferences) {
            dataLayer.push({'event':'truendo_cc_preferences'});
        }
        if (cookieObj.marketing) {
            dataLayer.push({'event':'truendo_cc_marketing'});
        }
        if (cookieObj.statistics) {
            dataLayer.push({'event':'truendo_cc_statistics'});
        }
        if (cookieObj.social_content){
            dataLayer.push({'event':'truendo_cc_social_content'});
        }
        if (cookieObj.social_sharing) {
            dataLayer.push({'event':'truendo_cc_social_sharing'});
        }    
    }
    </script>
    <!-- TRUENDO Privacy Center -->
    <script async="" id="truendoPrivacyPanel" type="text/javascript" src="https://cdn.truendo.com/pc/app.pid.js" data-siteid="YOU WEBSITE ID"></script>
    <!-- End TREUNDO Privacy Center -->
    
Note: You need to add the TRUENDO integration script in here instead of the head if you want to call TRUENDO via Tag Manager. Don’t forget to change the Site ID to yours when copying this script!
  1. Tick Support document.write on.
  2. Click on Triggering and add All Pages and press Save.

Tag Creation Screenshot

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-decode cookie and press Save.

TRUENDO Cookie Variable Screenshot

Step 3 (Special Case)

Some of your tags might have triggers that fire at very specific events (e.g.: a tag that fires on certain scroll depths) as opposed to on every page. In this case you need to connect that event with TRUENDO’s categories. To do that we have to make sure that each Trigger has an additional condition to only fire when the category is set to true.

  1. Go to Triggers.
  2. Click on the triggers 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

Scroll Depth Example

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

Note: The necessary category does not need a trigger as everything that falls under this category does not require consent.

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.

TRUENDO triggers

Step 5

The last step is applying these triggers to the other tags (E.g. Google Analytics, Hotjar, Outbrain, etc.) you want to control. Every tag that is triggered on all pages gets the trigger that applies to their category. Tags that use special events retain those triggers, since we have modified those to work with TRUENDO.

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!