Support » Plugin: GDPR Cookie Compliance (CCPA, PIPEDA ready) » GTM not working while adding code to 3rd party cookie section

  • Resolved nabaraj chapagain


    The GTM wont fire any tags if we add the script in third party header section. If added directly to the header, which works perfectly!

    The reason for this is not loading the script to the header once clicked ‘accept’. Its added dynamically so wont work at all.

    How do we sort this issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Moove Agency


    Hi @nabaraj-chapagain,

    Thanks for using our plugins.

    Could you please provide more details about the issue?
    What is the script you are using on your website (you can replace the ID’s with custom XYZ strings)?
    What is your website URL where we can check the issue?

    You can check our related topics as well:

    Hope this helps.

    nabaraj chapagain



    Thanks for the reply. Below is the GTM code

    <!– Google Tag Manager –>
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    <!– End Google Tag Manager –>

    I’ve put this inside the third party cookie section. We’re trying to track some form submissions and button clicks.

    The GTM preview mode wont work. The code that is dynamically injected wont record any conversions.

    We cant directly add to code to header because of the cookie added by the GTM. And trying to make it GDPR compliance wont track anything after moved from header to the plugin header section.

    Any solution for this?

    nabaraj chapagain


    Can you provide some updates please?

    Plugin Author Moove Agency


    Hi @nabaraj-chapagain,

    Please replace your GTM script with the following snippet, and place to the correct position (peplace the GTM-ZZZZZZ to your real ID):

    Third Party – Header Scripts

    <!-- Google Tag Manager -->
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    <!-- End Google Tag Manager -->

    Third Party – Body Scripts

    <!-- Google Tag Manager (noscript) -->
    <noscript><iframe src=""
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->

    Also, please ensure the is not protected, so if you open in a browser, you should see a 0. Sometimes the wp-admin area is protected but the admin-ajax.php is not whitelisted and this causes the issue. If it’s protected and you can’t whitelist the AJAX in your website, you can add the following code snippet to your functions.php
    add_action( 'gdpr_cc_prevent_ajax_script_inject', '__return_true' );

    If none of the solutions listed above is working, please share your site URL in order to see the errors and start the investigation for you.


Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.