cancel
Showing results for 
Search instead for 
Did you mean: 

Cookie Restriction Mode and Google Analytics

Highlighted

Cookie Restriction Mode and Google Analytics

Hi all....

I've recently turned on 'Cookie Restriction Mode' in our Magento 2.3.3 instance and since then, our Google Analytics numbers have fallen off a cliff.

As I understood it, when a customer 'agrees' and accepts our site's cookie policy, google analytics would continue to track our visitors activity. But this isn't happening at all.

A good 70% of traffic doesn't get tracked.

The only Google Analytics code I can see in the source code is the below.

If I turn off the 'cookie restriction mode', the code updates to '"isCookieRestrictionModeEnabled": 1',

Does anyone have a fix for this please?

I have tried updating our Google Account following this guidance, but this didn't seem to work.

https://docs.magento.com/user-guide/stores/compliance-privacy-google.html 

Many Thanks in advance

Andy

<script type="text/x-magento-init">
{
    "*": {
        "Magento_GoogleAnalytics/js/google-analytics": {
            "isCookieRestrictionModeEnabled": 0,
            "currentWebsite": 1,
            "cookieName": "user_allowed_save_cookie",
            "ordersTrackingData": [],
            "pageTrackingData": {"optPageUrl":"","isAnonymizedIpActive":false,"accountId":"UA-ouridreplaced-1"}        }
    }
}
</script>
2 REPLIES 2
Highlighted

Re: Cookie Restriction Mode and Google Analytics

Hi @Andy_Acute 

Kindly refer below link for enable 'Cookie Restriction Mode':

 

https://docs.magento.com/user-guide/stores/compliance-cookie-restriction-mode.html

 

It may help you to resolve issue.

If issue resolve, please click on 'Kudos' & Accept as Solution!

Highlighted

Re: Cookie Restriction Mode and Google Analytics

Hi Bhanu

Thank you for replying to my post, but unfortunately this didn't fix my issue.

The Google Analytics code inserted into the source code changes from:

"isCookieRestrictionModeEnabled": o,
to
"isCookieRestrictionModeEnabled": 1,

And this stops all tracking in Google Analytics 'Real Time'.

Any oher advice?

Thanks

Andy