• Resolved bosmit

    (@bosmit)


    Hello,

    I have an issue I have tried to solve for days now but I haven’t succeeded.
    After setting up the plugin Complianz I noticed that my traffic wasn’t at all what it used to be. After using TagBird I figured that it is because Google Analytics is blocked before consent.

    In the complianz wizard, I have completed & checked the 3 boxes so that statistics are set to anonymous. I have set the ‘Do you want to ask consent for statistics?’ to No. I have set the ”Do you want Complianz to add Google Analytics to your website?” to yes, and provided my UA tracking ID.

    Regardless, complianz still blocks Google Analytics before consent is given.

    I would be really really thankful for any help, as I would love to continue using complianz!

    Best regards,
    Bo

    • This topic was modified 1 year, 8 months ago by bosmit.

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

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

    (@aahulsebos)

    Hi @bosmit,

    I double-checked, and it should work. I have an example here with the same settings; https://ikes-again-misa.instawp.xyz/

    But in the code of your website I see consent is indeed still needed for consent. The difference is an attribute in the script itself. Could it be you’re serving static HTML and you need to publish again, clear caching or similar?

    Or maybe there’s something in your script center that triggers on analytics as well.

    Before we find out why, you could circumvent this by whitelisting “tagmanager.com” and “gtag()” in the script center.

    Or in the wizard, disable Complianz adding the script and adding it yourself with an attribute for example:

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script data-category="functional" async src="https://www.googletagmanager.com/gtag/js?id=YOURCODE"></script>
    <script data-category="functional">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'YOURCODE');
    </script>
    <!-- Analytics -->
    Thread Starter bosmit

    (@bosmit)

    Hello again! Thank you for a quick reply!

    I’m no web developer and I learn as I go, so it takes me some time to understand it all. ??

    1. I don’t know if I’m serving static HTML. I guess I’m not because I don’t even know what it meant (before I googled it).

    2. I’ve checked the script center in Complianz and nothing was activated there except for whitelisting Burst statistics.

    I’ve now whitelisted tagmanager.com and gtag() in complianz script center like this: https://postimg.cc/KRzKwCxh (which is hopefully the correct way). Do I need to configure the wizard again after this? Because right now it doesn’t make a difference for what I can see.

    Thank you!

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @bosmit,

    Let’s continue with the “whitelisting” route for now, and if that doesn’t work; we’ll try an alternative approach.

    I see that you have the scripts added to the whitelist, but they are ‘comma-separated’ at the moment. They have to be added on separate lines, which you can do by clicking the + icon.

    You should end up with a configuration like this:

    Kind regards, Jarno

    Thread Starter bosmit

    (@bosmit)

    Hi @jarnovos !

    I now whitelisted tagmanager.com and gtag() on seperate lines exactly like in your picture. But unfortunately, it didn’t solve the problem ??

    Best regards, Bo.

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @bosmit,

    I can’t quite explain why it happens, especially as the same configuration works on the example site that @aahulsebos attached earlier: but we can go for a manual implementation instead.

    An easy way to go about this would be to use the Header Footer Code Manager (HFCM) plugin to easily add code snippets, although you can also add this in a file of your theme, if preferred.

    With the HFCM plugin activated, follow these steps:

    • Navigate to Complianz > Wizard > Consent > Statistics – confguration and answer “Do you want Complianz to add Google Analytics to your website?” with No.
    • Create a new snippet in HFCM, set the Snippet Type to “JavaScript”, the Location to “Footer” and the Status to “Active”
    • Copy the below lines to the snippet/code field, and Save when done.
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script data-category="functional" async src="https://www.googletagmanager.com/gtag/js?id=UA-158585795-1"></script>
    <script data-category="functional">
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-158585795-1');
    </script>
    <!-- End Analytics -->

    Your Analytics script for the “UA-” property should now load without requiring Statistics consent.

    Hope it helps! Kind regards, Jarno

    Thread Starter bosmit

    (@bosmit)

    Hi @jarnovos ,

    I already had a plugin like that called WPCode lite, so after I set “Do you want Complianz to add Google Analytics to your website?” to ”No”, I pasted the code you provided in the header section (as google recommends pasting the analytics code in the header for more accurate tracking).

    It now finally seems to work!! ??

    However, I had a last question: Are the IP addresses also anonymized with the code you provided? Or do I need to alter the code in some way so that happens?

    Really grateful for all the help!
    Best regards,
    Bo

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @bosmit,

    Glad to hear! While this is the case by default for GA4 properties, for UA properties you will indeed require an additional line.

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

    Details here: https://support.google.com/analytics/answer/2763052?hl=en

    Kind regards, Jarno

    Thread Starter bosmit

    (@bosmit)

    Hi @jarnovos

    Alright got it!
    Thanks again for all your help! Finally being able to solve this issue really made my day ??

    Best regards,
    Bo

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Complianz is blocking Google Analytics before consent’ is closed to new replies.