How to combine two GDPR consent messages for Adsense and Google Analytics 4 into one message?
Asked Answered
G

3

6

I have implemented Google Analytics 4 and AdSense on my website.

I'm currently using Google Analytics 4 without Tag Manager and have coded a custom consent message. For AdSense, there is an automatic consent call. However, this situation results in two consent messages popping up one after another, which doesn't provide a great user experience.

Is there a method to combine the consent messages for Google Analytics 4 and AdSense into one?

I tried searching for similar topics on the web but didn't find anything.

Gynaeceum answered 27/7, 2023 at 9:42 Comment(0)
I
3

I suggest to wait some time. All this consent thing is so cryptic to simple publishers. I suspect that google will provide some easier options to unite Analytics 4 and Adsense messages. Other free ways are too much cryptic.

As a side note all those EU GDPR requirements are smoke and mirrors. Users just use "Accept" or "Decline". No one in their mind will go through list of 200 vendors to choose individual choice. And even when choosing "Accept" or "Decline" most users don't know what they are doing. The same as with too many pop-ups in regular software - "OK, OK, OK, esc, esc, esc".

Hera some CMP list which includes free ones but they are trackers by themselves :) As I said smoke and mirrors :)

https://geekflare.com/best-cmp-solutions/

Intemperance answered 12/8, 2023 at 13:21 Comment(1)
Can you tell me how you have done it without any CMP ?Redvers
G
3

It looks like Google Analytics and the Adsense default CMP adhere to TCF v2.0 which is a standard for consent management.

According to this documentation if you set the variable window.gtag_enable_tcf_support to true, this is how you enable Google Analytics compatibility.

If I understand correctly, consent 'TC strings' should flow through from whatever Consent Management Platform (CMP) you are using. In the case of the default Adsense one, it's the one you enable in your account to display GDPR consent message.

Please correct me if I'm wrong.

The google analytics code, EG https://www.googletagmanager.com/gtag/js?id=UA-1234567 shows that it determines whether each 'purpose' is granded or not based on responses from the CMP:

Use of gtag_enable_tcf_support in GA tag code:

enter image description here

Purposes from CMP (true if allowed, false if not): enter image description here

However, this still sets the cookie. It looks like to explicitly prevent GA cookies from being set you have to set the following window variable:

window['ga-disable-UA-XXXXXX-Y'] = true;

Where UA-XXXXXX-Y is replaced with your Google Analytics ID.

Gambit answered 8/9, 2023 at 14:38 Comment(10)
Not sure why but they removed that bit of documentation that is linked, either permanently or temporaraily. You may view it on the archive hereGambit
I don't know why but this solution it's not working, I denied all purposes in my CMP and GA4 still created the _ga_XXXXX cookie.Seto
Is there a bit of documentation that says that they won't create the cookie? the purposes are about how the data will be processed, not sure if it relates to cookies directly.Gambit
Purpose 1 says "Store and/or access information on a device". Create a cookie is a store data procedure. If purpose 1 is denied in CMP no cookies should be created. "While Purpose 1 is not a data processing purpose, is technically treated the same way for signalling purposes." You can read here: iabeurope.eu/wp-content/uploads/2022/06/…Seto
I wish I could say I could understand it, but here has a write up about 'Consent mode' from Google. I'm not sure if that helps or not..... gl. Please report back when you have the answerGambit
Consent Mode for Google Analytics has no related with the consent in a CMP. If 'window.gtag_enable_tcf_support' worked it would be great. At this moment if you want to comply with the regulations of GDPR you have to get consent with CMP, after you have to read the JSON data consent with Google Funding Choices Javascript API and if you got consent for purpose 1 enable GA4 with analytics_storage:'granted'. If you got consent for ad personalization or not you will have to set others parameters of GA4 consent mode denied or granted too.Seto
@Seto I've just looked at the code for Google Analytics that you include in the page and it explicitly looks for the consent status received from the CMP. This code I'll put a screenshot of what I've seen in their code. It looks like it examines them and determines whether each purpose is granted or denied...Gambit
I've just tested the window['ga-disable-UA-XXXXXX-Y'] = true; approach on my site and it appears to work, no _ga cookies are set. So I wonder if that can be integrated with your CMP...?Gambit
Pretty much every site I go on, even if I go on the official documentation for a lot of these CMPs still drop the ga_ cookie even if I reject all cookies!! EG. quantcast.com/blog/…Gambit
Here's a very useful video youtube.com/watch?v=MqAEbshMv84 It looks like most CMPs integrate with Google Analytics consent already. So you shouldn't need to hand ball the code yourself...Gambit
J
1

Just use the TCF Approval Tool version 2.0. Google recommends several tools.

Jolley answered 1/8, 2023 at 14:22 Comment(14)
What does it mean? How can I get this tool?Gynaeceum
For example, "quantcast" is a free tool.Jolley
If I'm understanding this correctly it looks like Google analytics and Adsense both adhere to the TCF v2.0 standards. So if you turn it on by setting window.gtag_enable_tcf_support=true in the browser, the user's consent settings should be shared.Gambit
@Gambit what doest that mean? If user will agree Adsense consent, I may not show my custom consent?Gynaeceum
The Adsense controls are the same as the ones for Analytics. If your user accepts all of the 'purposes' shown in the Google Adsense consent popup then all Google Analytics features will work for you for that user. You can see how not accepting will affect the processing of a user's data in the table on this page. You can also configure your own purposes using Adsense.Gambit
@Gambit thank you, is there a way to know that user accepted consent and what options selected?Gynaeceum
The details that you're after are in the TCF v2.0 documentation. All CMSs that adhere to the standard store the details in a predictably named cookie. The data can be examined. If you take the value of the cookie stored on your device when you have given your choices on a consent banner, get the value and paste it here to see what it contains: iabtcf.com/#/decode Your application can do the same, because it will receive this cookie with every request.Gambit
I am not an authority on the subject, but I am under the impression that the IAB have simplified the requests for data processing into various "purposes" that are the same for all advertising products so that they can gain consent for all of them at once. I'm not exactly certain how they map to our own purposes, but looking at them I think can be interpreted in a way that is adequate for our own uses.Gambit
@Gambit I found that Adsense consent creates cookie named "FCCDCF" on my device, I tried to encode it by the link you kindly provided, but it didn't worked.Gynaeceum
@Gynaeceum FCCDCF is the name of the old cookie. The new one is something like euconsent-v2 and probably others. v2 meaning the new standard TCF v2.0Gambit
@Gynaeceum I'm not sure why, or whether I am just wrong about the cookie naming thing, but I can see on your site that it's generating that cookie FCCDCF. That cookie, if you URL decode it and then get the second value from the quotes and put it into the decode tool it's a TCF v2 consent string, so it's definitely generating a TCF v2 consent string. How that interops with other services I'm not exactly sure if it's not predictably naming the cookie... but it says it works with TCF v2 hereGambit
@luke ohh, now I got something. I needed to decode url, then to decode second value. But still it's not clear, how do I know what was user choice to turn on/off google analytics tracking?Gynaeceum
The documentation says that it works out of the box. If it's compatible with TCF v2 then it's compatible with it. Are you sure it's not just doing it?Gambit
@Gambit on my side I have two things: 1. Cookies consent 2. Google Analytics code with events. Do you mean that if I have this Google Consent banner I don't have to show my consent and I can run Google Analytics as usual, and it will work according to user's choice?Gynaeceum

© 2022 - 2024 — McMap. All rights reserved.