Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Analytics Champion Program are open!

Google Consent mode v2 implementation using Adobe Launch

Avatar

Level 2

Hi All,

 

Anyone done poc/pov/implementation for Google consent mode v2 implementation using Adobe launch .

 

I got some soultion using below code

gtag('consent', 'default', {
  'ad_storage': 'denied',
  'analytics_storage': 'denied'
});

but anyone recent done same approach. 

 

Thanks & Regards,

Madhusudan Sura | +919423067216

 

Thanks & Regards,

Madhusudan Sura | +919423067216

 

5 Replies

Avatar

Level 5

Hi @Madhusudan_S 

I implemented something like this for a client and seems to work, given that the Data Element "consent" is an object, containing your user's currently given consent with attributes "marketing", "analytics" and "personalization".

 

/**
 * Sample "consent" Data Element response
 * {
 *   marketing: true,
 *   analytics: false,
 *   personalization: true,
 * }
 */
const consent = _satellite.getVar("consent", event) || {};

gtag('consent', 'default', {
    'ad_storage': consent.marketing ? 'granted' : 'denied',
    'analytics_storage': consent.analytics ? 'granted' : 'denied',
    'ad_user_data': consent.marketing ? 'granted' : 'denied',
    'ad_personalization': consent.personalization ? 'granted' : 'denied',
    'wait_for_update': 500
});

 

 

Alternatively to or in combination with the dedicated "consent" Data Element, you can also use the approach @fhusain suggested in combination with above code, using the "adobe.optIn" API

to map the values. However, I prefer having one Data Element that is used as base for both the Adobe API and the Google Consent Mode.


Hope that helps,
Björn

Avatar

Community Advisor

I second the dedicated "consent" Data Element... process the consent once, then use for everything...  if you need to make changes or updates, it's in one place.

Avatar

Level 1

So where is this implemented? As a condition for the Google related rules?

Avatar

Level 5

@fahadharur1  you will need to inject this on page load or at least, before you load any google library