Google Consent Mode v2
Consent Mode v2 is a technology from Google that makes it possible to use certain Google services without setting cookies until the user has given consent.
Without consent, Google will perform limited tracking of traffic and any conversions. The advantage of Google Consent Mode is, for example, that the website owner can still view statistics and conversions even though the visitor has not given consent for statistics cookies.
Read more about how CookieTractor integrates Google Consent Mode v2.
Get started
If Google Tag Manager is used to manage cookies, select the built-in All Pages as the trigger for the tag that is to be managed. This way, it is always loaded but adapts its behaviour based on the visitor’s consent.
An alternative to Google Tag Manager is to ensure that CookieTractor is initialised before any Google services, such as Google Analytics 4. This is best done with code set up as render-blocking, where the CookieTractor script is placed before GA4 in the HTML code.
Test the implementation
Verification using query string
To check the implementation you can add a query string parameter, ct-debug=true, to the website URL. With that in the request, we output information about the result of our automated tests. More on this can be found on the Verify the implementation page.
Manual verification
You can also verify if Google Consent Mode is working correctly by inspecting the requests to the compatible services you have implemented.
Steps to verify that Google Analytics 4 is correctly implemented:
- Delete all cookies and reload the page, or open a new private browser window.
- You should now see our cookie banner, and a request to *.google-analytics.com should have been sent with a query string that includes gcs=G100. This means that Analytics has been called, but without consent for cookies.
- At this stage, no cookie starting with _ga should have been stored on the domain.
- Then click Accept all in the cookie banner. Within a few seconds, cookies named _ga should be created, which indicates that the Analytics tag has picked up the updated consent and has started using cookies.
Google Tag Assistant
You can also use Google Tag Assistant, where you can follow the entire flow showing which consents were given and when.
Tag settings
When Google Consent Mode v2 is initialised, a number of settings are applied that determine how the function will behave:
- url_passthrough (default: false)
- ads_data_redaction (default: true)
- wait_for_update (default: 1500)
If you wish to adjust these, you can do so with the following code:
<script type="text/javascript">
cookieConsentSettings = {
cmAdsDataRedaction: true,
cmUrlPassthrough: false,
cmWaitForUpdate: 1500,
}
</script>
<script src="https://cdn.cookietractor.com/cookietractor.js" data-lang="sv-SE" data-id="{{your-website-key}}"></script>
Related information
Support
Do you have questions about Google Consent Mode or Google Tag Manager for your installation? Feel free to contact us at google@cookietractor.com. Google does not provide direct support for the product – support should primarily go through us.