What is Gtag (Global Site Tag) and do I need to use it?
In short, gtag.js is an easy way to embed all the Google tools and products in use on your website (like Google Analytics, Google Ads etc.) using a single tag.
If you are currently using Google Tag Manager (GTM) you do not need to use the gtag.js - you can continue to use GTM just as before (see our general GTM installation guide here: https://support.cookiebot.com/hc/en-us/articles/360003793854-Google-Tag-Manager-deployment).
How do I connect Gtag with Cookiebot?
As of September 3rd, 2020, Gtag supports Google Consent Mode. Cookiebot integrates to this API by Google, so that Gtag will automatically change behaviour in accordance with the end user's consent. All you need to do is to add an additional code snippet before your current Gtag snippet:
When you embed your Cookiebot tag on the site as well, Cookiebot will automatically connect with Gtag and signal the end user's consent through the Consent Mode API.
If you have enabled auto-blocking in Cookiebot, you also need to apply the tag attribute to all three Gtag script tags as above.
You may change the values of ad_storage and analytics_storage to 'granted' and set ads_data_redaction to 'false' if you want to default to an opt-in before the end user has submitted consent, for example allowing for a default opt-in under CCPA.