Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author pressidium

    (@pressidium)

    Hey, @nikodemsky!

    Your Google Tag Manager (GTM) snippet:

    <script data-cookiecategory="analytics">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
        j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
        'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
        })(window,document,'script','dataLayer','GTM-WW3CNFH');</script>

    seems to be loading too early, which may interfere with our “Blocking scripts” functionality and Google Consent Mode (GCM) integration.

    Our plugin tries to load its files (/public/block-scripts.js and /public/consent-mode.js) before other scripts, by hooking into wp_head and wp_enqueue_script with a priority of -10 — lower numbers correspond with earlier execution.

    However, that won’t work in certain scenarios, such as:

    • Your GTM snippet is hardcoded into your theme before do_action( 'wp_head' );
    • You’re using an mu-plugin to load your GTM snippet, which is going to load before normal plugins
    • You’re hooking into wp_head specifying an even lower priority than -10
    • etc.

    Could you please try to load your GTM snippet after our plugin’s JS files have loaded, and then try again?

    If the problem persists after those adjustments, please let us know so we can further investigate the issue.

    Thread Starter Nikodemsky

    (@nikodemsky)

    I have moved the gtm script after wp_head and now it works, thanks!

    Plugin Author pressidium

    (@pressidium)

    Thanks for following up! It’s good to know that everything is resolved.

    If you come across any other issues, feel free to create a new topic or open an issue on GitHub.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can’t block _gcl_au cookie’ is closed to new replies.