Consent API

We are introducing Google Consent Mode in Flight version 5.15.1. In an early release we've decided to release this behind an optional setting that defaults to false, which means as a partner you'd have to activate this for the client to take advantage of the functionality.

More information on how to get started with Google Consent Mode here.

More information on how to utilize Google Constent Mode in Cookiebot here.

In shop.config have useTrackingConsentAPI set to true to activate Google consent APIs.


With this active, we're acting on a cookie named GoogleTrackingConsent and it's values. The default behaviour is listed below and added to the data layer if the cookie is not present.

Consent Value
ad_storage denied
analytics_storage denied
personalization_storage denied
functionality_storage granted
security_storage granted

With the cookie present, we're adding it's value to the data layer, by default it looks like this:

Consent Value
ad_storage granted
analytics_storage granted
personalization_storage granted
functionality_storage granted
security_storage granted

With Consent mode we have also introduced another tracker named consent, with this you're able to either send the default settings mentioned above, or send a customized object with your own settings. More information on the track function can be found here. In our Demostore, we've added the following to the CookieConsent component since in our case, any other consent than default is not required:

const track = useTracker()
function agree() {
/** Rest of function body */
        name: 'consent'

This function takes care of adding the GoogleTrackingConsent cookie with the values passed into the track function, this cookie is later read when revisiting the store to preserve consents and is also read from checkout to keep consents between the two apps. The track-function also adds the consent.update event to data layer.

From template-trend we're exposing this function to the window object as window.consent = agree, this can be useful if you have the need to call this function from outside the framework, in say Google Tag Mananger. This is editable in the CookieConsent component.


If Google Tag Manager is activated, we're only adding the first consent default event: event: 'gtm_consent_default'.

As we do with GTAG/GA4 consents, we're listening for a cookie named GoogleTrackingConsent and base our default values from it. All consent updates should be handled from GTM or using a Content Management Plattform (CMP) such as Cookiebot. Google is keeping a list of available CMP templates here.

Simo Ahava is also providing a template with instructions for you to import to your container if you'd like to control all consent actions yourself. NB: Since we already are inserting the default event, this can be removed from this particular template.

Copyright © Norce 2023. All right reserved.