Skip to main content

dataLayer pushes working inconsistently

Completed

Comments

2 comments

  • Oleg Eremenko

    Same problem here, I've sent a ticket regarding this, the dev team is looking into this.

    0
  • Gunnar Griese

    Hi Oleg,

    Cookiebot support came back to me with the following instructions for a workaround:

     

    It appears a recent release resulted in events not getting pushed to the dataLayer anymore when using auto blocking and Google Tag Manager. 
    Our developers have been notified and are working on a solution.

    As a temporary work around, you can use this script to manually push events to the dataLayer is consent has been given:

    <script>
    (function () {
    var CookiebotEventsPushed = false;
    for (i = 0; i < dataLayer.length; i++) { if ( dataLayer[i].event == "cookie_consent_preferences" ||
    dataLayer[i].event == "cookie_consent_statistics" ||
    dataLayer[i].event == "cookie_consent_marketing")
    CookiebotEventsPushed = true;
    } if (!CookiebotEventsPushed && Cookiebot.consented) {
    Cookiebot.consent.preferences && dataLayer.push({ event: "cookie_consent_preferences" });
    Cookiebot.consent.statistics && dataLayer.push({ event: "cookie_consent_statistics" });
    Cookiebot.consent.marketing && dataLayer.push({ event: "cookie_consent_marketing" });
    }
    })();
    </script>
    0

Post is closed for comments.