Google Tag Manager and Automatic cookie blocking

Follow

Comments

9 comments

  • Avatar
    Mhamilton

    When would you use this installation mode versus the other one outlined here: https://support.cookiebot.com/hc/en-us/articles/360003793854

    We are having issues of Pardot tracking working with Cookiebot -- will changing the deployment help with that?

    6
    Comment actions Permalink
  • Avatar
    Henrik Söderlund

    Great guide, thanks! With this implementation I found that the GTM Preview & Debug Mode stops working as it seems to block the GTM preview JS library from loading in the browser. What do you recommend?

    1
    Comment actions Permalink
  • Avatar
    Roel Cuijpers

    Same issue :( 

     

    Plus when i agree with the cookies and go back to the page with the video, it doesnt show up anymore? 

    0
    Comment actions Permalink
  • Avatar
    Yoannis Jamar

    As pointed out above, this setup seems to break GTM's "Preview and Debug mode". The debug panel seems to open, but it remains an empty box.

    In the browser's dev-tools, it seems the loading of the "https://tagmanager.google.com/debug/debuguiApp-bundle.js" script is cancelled, and I am guessing this is due to Cookiebot's automatic blocking behaviour?

    Since that script is loaded by GTM behind the scenes, it is not possible to allow it with the `data-cookieconsent="ignore"` attribute. Is there any other way to add exceptions to Cookiebot's automatic blocking ? Or can automatic blocking with GTM be implemented in another way, that does not break the preview and debug mode?

    5
    Comment actions Permalink
  • Avatar
    Matthew Shepherd

    Using this implementation as far as I can tell only fires your tags after the consent dialog is submitted (only on the first page the consent is provided on). In my tests, if you set your cookie preferences and then navigate to another page the cookie_consent_ events don't fire. Am I missing something?

    I got around this by adding the following code after my cookiebot script on each page

    <script>
    function CookiebotCallback_OnAccept() {
    if (Cookiebot.consent.preferences)
    dataLayer.push({'event':'cookie_consent_preferences'});
    if (Cookiebot.consent.statistics)
    dataLayer.push({'event':'cookie_consent_statistics'});
    if (Cookiebot.consent.marketing)
    dataLayer.push({'event':'cookie_consent_marketing'});
    }
    </script>

    Another thing worth noting is that if you are pushing the cookie_consent_ events manually, as described above, and triggering your Google Analytics tracking script using these events in Google Tag Manager, make sure to configure the Tag Firing Options (Under Advanced Settings) to 'Once per page'. Otherwise, the GA script will fire twice causing two page hits instead of one.

    0
    Comment actions Permalink
  • Avatar
    Benjamin

    Hi Matthew, would that script work in a custom HTML tag in tag manager that triggers on all pages then? 

    0
    Comment actions Permalink
  • Avatar
    Manjunath

    Hi,

    I have followed same steps described in this page and implemented in drupal website.

    And i could see JS variable "Cookiebot.consent" is set according user accept values and "dataLayer" event also triggering perfectly in all pages.

    Does this means its working fine? How can i confirm that GTM works perfectly after user accepts statistics consent and GTM doesnt when user doesn't provide consent?

    0
    Comment actions Permalink
  • Avatar
    Matthew Shepherd

    Benjamin:

    I wouldn't execute that script via Tag Manager, I just placed it immediately below my Cookiebot script directly in the site's head code. Worth double-checking my observations are correct (cookie_consent_ events not firing on subsequent pages) on your own site too.

    Another thing worth noting is that if you are pushing the cookie_consent_ events manually as described above and triggering your Google Analytics tracking script using these events in Google Tag Manager make sure to configure the Tag Firing Options (Under Advanced Settings) to 'Once per page'. Otherwise, the GA script will fire twice causing two page hits instead of one.

    Manjunath:

    If you followed the steps above, Cookiebot is likely blocking Google's Tag Manager preview functionality (if not let me know how you are achieving that.)

    I use the Ghostery and EditThisCookie Chrome extensions to monitor which tags and cookies are firing and when. Just make sure to turn off Ghostery's ad-blocking features or it will block your tags and cookies itself.

    Also, using Google Tag Assistant recordings is a useful way to see which tags are firing and what is happening with your Google Analytics tracking.

     

    0
    Comment actions Permalink
  • Avatar
    Richard van der Velde

    Hi Matthew,

    You don't need to include that script to each page. The Cookiebot script pushes these events to the dataLayer on each page when the script loads.

    If you push the events again, your triggers will also fire your tags again.

    We're also aware that the preview doesn't work if you combine Cookiebot with automatic cookie blocking and Google Tag Manager. The reason for this is that you'll be referring to events that aren't known in Google Tag Manager, since they'll be pushed to the dataLayer outside of Google Tag Manager.

    0
    Comment actions Permalink

Please sign in to leave a comment.