How to set up Google Tag Manager with CookieYes

In this article we will see a simple guide on how to configure Google Tag Manager with CookieYes, so that all the tags you launch from your GTM container in accordance with the consent that the user gives you when interacting with the cookie banner.

Why use a cookie consent tool?

If you have a website, you are obliged to obtain cookie consent from visitors. Most countries have data protection laws in this regard. In the case of European Union countries, the regulation that applies is the RGPD (or GDPR).

This consent is collected through a cookie banner that allows visitors to accept, reject or set cookies from the website.

CookieYes

So far, I have had contact with several of these platforms: OneTrust (and its scaled-down version CookiePro), CookieBot and CookieYes.

The reasons why I tried CookieYes are as follows:

  • CookiePro, which was the one I had been using until now, was eliminating its free plan, so my smaller projects would have an additional cost.
  • CookieBot ‘s free plan is limited to only 50 pages within a website. Once you exceed that number, the banner is no longer displayed.
  • CookieYes features a free plan that allows you to scan up to 100 pages and record up to 25,000 page views (as of June 2023). In addition, CookieYes is technically less cumbersome and requires fewer calls than CookiePro.

How does CookieYes work to integrate with GTM?

It works with two mechanisms: an event in the dataLayer and a 1st party cookie:

Event in the dataLayer

CookieYes will generate an event in the dataLayer called “cookie_consent_update” each time a page loads or the user changes their cookie consent:

This event will serve as a trigger in GTM.

1st party cookie by CookieYes

In turn, CookieYes stores in a cookie called“cookieyes-content” the information related to the user’s consent, and it is the one that sends to the previous event of the dataLayer:

The information contained in this cookie will be used as an exception in GTM triggers/activators.

How to set up Google Tag Manager with CookieYes

With all this, we would create the following:

  1. A variable, of the type “source cookie” in which we indicate the name of the cookie “cookieyes-consent”, mentioned above.
  1. A trigger, using the name of the dataLayer event we saw before, that would replace the “All pages” that GTM offers by default:
  1. The exceptions for the trigger, which will prevent the labels from being executed when the user has not given his consent, which will be fed from the variable that we configured previously:

We will have to configure as many exceptions as types of cookies CookieYes has. These are:

  • For functional cookies rejected: “functional:no”.
  • For rejected analytics cookies: “analytics:no”.
  • For rejected customization cookies: “performance:no”.
  • For advertising cookies rejected: “advertisement:no”.

Thus, our triggering for CookieYes would look like this:

Finally, for a general label such as GA4, the triggering would look like this:

In this way, we would be telling GTM: “execute the GA4 tag every time the ‘cookie_consent_update’ event is triggered (all pages), unless the user has rejected analytics cookies”.

For the rest of the tags that you use in the container with other triggers, you would only have to add the exception depending on the type: analytics, advertising, functionality…

In the case of a GA4 tag to send a purchase, the activation would look like this:

Do you prefer it simpler? Template to download

Here is the template with the variable and triggers we have described so that you can test it in your GTM container.

Another day we could go into the CookieYes platform in depth.

Did you find the article useful? Leave a comment :)

Leave a Comment