Forums » Plugin: Complianz - GDPR/CCPA Cookie Consent » Duplicate tag for analytics

  • Resolved crauser

    (@crauser)


    Hello again,

    I have some problems with duplicate tag for analytics after accept the cookies in this website. I testing the web with tag assistant. This is the error “Same web property ID is tracked twice.”

    I’m using the plugin “Header Footer Code Manager” to add the scripts in the whole site.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser,

    You can use Complianz – Wizard – Cookies – Statistics to add statistics as well, whereby adding it somewhere else is not needed.

    Or you can add it outside of Complianz by answering either:

    Yes, Anonymous or
    Yes, and personal data is available to us.

    Depending on the question you can then communicate with our cookie blocker by adding classes to the script tags.

    <script class=”type/javascript” class=”cmplz-native”></script> // Anonymous
    <script class=”type/plain” class=”cmplz-stats”></script> // Personal data

    Hope this helps,

    regards Aert

    • This reply was modified 3 years, 6 months ago by Aert Hulsebos.
    Thread Starter crauser

    (@crauser)

    Ok, I answered “Yes, with google analytics” to that question. So in that case I should add the analytics tracking code to my web site or not?

    Leave the screen capture
    https://pasteboard.co/JuQ72oB.jpg

    this is the tracking code I added using de plugin “Header Footer Code Manager”

    <!– Global site tag (gtag.js) – Google Analytics –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-X”></script&gt;
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘UA-XXXXXXX-X’);
    </script>

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser.

    Ok, I answered “Yes, with google analytics” to that question. So in that case I should add the analytics tracking code to my web site or not?

    >> In this case Complianz will add it for you.

    You can answer “Yes, Anonymous” and add the below code instead:

    <!– Global site tag (gtag.js) – Google Analytics –>
    <script class="cmplz-native" type="text/javascript" async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-X”></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());
    
    gtag(‘config’, ‘UA-XXXXXXX-X’);
    </script>
    • This reply was modified 3 years, 6 months ago by Aert Hulsebos.
    Thread Starter crauser

    (@crauser)

    I did it the fisrt one, but this error appears after accept all cookies “Invalid call to gtag(), the Global site snippet is not installed”

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser,

    This doesn’t to be about the above code, as it doesn’t seem to be implemented. Isee this code, from Complianz for Analytics, which is not gtag.js.

    <script type="text/plain" class="cmplz-script cmplz-stats cmplz-stats">(function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
    ga('create', 'UA-XXXXXXX-1', 'auto');
    ga('send', 'pageview', {
        'anonymizeIp': true
    });</script> 
    Thread Starter crauser

    (@crauser)

    I add the code using “class=”cmplz-native” type=”text/javascript” just like you suggest but shows again de duplicate tag. I should add the code using the scripts center od complianz?

    sorry for bother you

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser,

    I see Complianz still adds the Analytics tag. Can you answer the question under Wizard – Cookies -> Statistics with Yes, Anonymous and continue to Statistics Configuration?

    Let me know,

    regards Aert

    Thread Starter crauser

    (@crauser)

    Hello again. I did it but now I have 2 questions. What about the anonymize IP? I can’t see that, is that good? and what about the acceptance of analytics cookies in the banner? it doesn’t show up.

    Thanks again for you help and you patience!

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser,

    At this moment I don’t see the implementation of Complianz, but I do see a correct implementation of this tag:

    <script class="cmplz-native" type="text/javascript" async src="https://www.googletagmanager.com/gtag/js?id=UA-158859820-1"></script> <script>window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-XXXX-1');</script>

    At this moment Complianz see Analytics as GDPR friendly and won’t add a statistics category, as it is set prior to consent.

    I would suggest changing:

    gtag('config', 'UA-XXXX-1');

    for

    gtag('config', 'UA-XXXX-1' , {'anonymize_ip': true });

    This will anonymize IP for your implementation,

    regards Aert

    Plugin Contributor Leon Wimmenhoeve

    (@leonwimmenhoeve)

    Hi @crauser,

    Did the suggested solution solve your problem, or do you need further assistance?

    Kind regards,
    Leon

    Thread Starter crauser

    (@crauser)

    Yes but not yes. what I mean is that I don’t see the duplicate tag for analytics thats good, but the option of marketing cookie acceptance in the banner unpear and I don’t want that.

    Thread Starter crauser

    (@crauser)

    I’ve been testing and by selecting “Yes, with google analytics” in complianz and removing the code <script type=”text/javascript” async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXX-1″></script&gt; the problems looks to be solve. But I don´t if that is ok.

    Thread Starter crauser

    (@crauser)

    I did everything and I don’t know what else to do, the tag is ok but the events doesn’t register in analytics what should I do

    Plugin Contributor Aert Hulsebos

    (@aahulsebos)

    Hi @crauser,

    The events run over gtag, which means you can’t use our implementation.

    1. Please change Yes, with Google Analytics to Yes, Anonymous, in the wizard.

    2. And add this code to your header.php, or with a plugin like header footer code manager;

    <script class="cmplz-native" type="text/javascript" async src="https://www.googletagmanager.com/gtag/js?id=UA-158859820-1"></script> <script>window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-XXXX-1');</script>

    This will configure gtag, and the event will appear.

    regards Aert

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Duplicate tag for analytics’ is closed to new replies.