5

I was trying to integrate cookieyes GDPR solution to a WP website. Below is the code for GTM and coookieyes that are added in the website. But the cookies

( _ga , _gid and gat_gtag_UA_xxxxxxxxxxx_1)

are getting set even if the accept button is not clicked.

<?php wp_head(); ?>
</head>
<!-- Start cookieyes banner -->
<script id="cookieyes" type="text/javascript" src="https://app.cookieyes.com/client_data/714e8fa9e198d23xxxxxxxxxx.js"></script>
<!-- End cookieyes banner --> 
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1" ></script>
<script>
    window.dataLayer = window.dataLayer || [];
    function gtag() {
        dataLayer.push(arguments);
    }
    gtag('js', new Date());
    gtag('config', 'UA-xxxxxxxxx-1');
</script>
mujuonly
  • 11,370
  • 5
  • 45
  • 75
Sarath G.P
  • 61
  • 5
  • Welcome to Stack Overflow! Your question lacks information to get any help from [so] users. Please take the [tour], and read through the [help], learn [ask] a good question? to maximize your chance to get answer to your questions. If you run into a specific problem and if you're stuck, send a description of the problem, including a [mcve] and people will be very glad to help you. This seems a nice question. For any help you may refer above links. – mujuonly Sep 24 '19 at 10:33
  • 1
    [Cookieyes](https://www.cookieyes.com/) will automatically block these cookies now prior to the consent – mujuonly May 16 '20 at 06:32

2 Answers2

3

To block the GTM cookies using CookieYes, what you need to do is add the data attribute 'data-cookieyes' to the GTM script tag. Set the value of the attribute to corresponding ( 'cookieyes-{category-name}' ) category.

For example, as the GTM script belongs to "Analytics" category, the value will be 'cookieyes-analytics'. In this case, to block the code prior-consent, change the GTM script tag as:

<script async data-cookieyes="cookieyes-analytics" src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-1" ></script>
<script>
   window.dataLayer = window.dataLayer || [];
   function gtag() {
       dataLayer.push(arguments);
   }
   gtag('js', new Date());
   gtag('config', 'UA-xxxxxxxxx-1');
</script>

This has been explained in detail here, How to Implement Prior Consent Using CookieYes.

Safwana
  • 86
  • 3
2

All set cookies is from Google analytics.

ga('create', 'UA-XXXXX-Y', {  'storage': 'none'});

Should stop them.

For more details read:

https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#disabling_cookies

Vykintas
  • 633
  • 5
  • 16