Integrate Osano with Google Consent Mode v2 to communicate user consent preferences to Google tags and services, allowing them to adjust their behavior based on what each user has agreed to.
Google Consent Mode allows websites to adjust how Google tags and scripts behave based on the user's consent choices. It is recommended for sites implementing Server-Side Tagging.
For more details on Google Consent Mode, view the official Google Consent Mode documentation.
Osano integrates with Google Consent Mode v2 as follows:
Based on the user's location and the consent configuration you have set up, Osano blocks non-essential cookies and scripts until the user grants consent.
Once consent is given, Osano communicates the user's preferences to Google Consent Mode, which adjusts the behavior of Google services based on those settings.
Note: Osano only shares consent preferences with Google, such as whether marketing or analytics cookies are accepted. No personal data is transmitted.
Requirement: Ensure you are using Google's gtag.js for this setup. Example:
<script src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>For more information on Google Consent with gtag, including which tags and containers are supported, see Google's gtag consent developer guide.
Google Consent Mode is automatically enabled for new configurations created after March 2024. If your configuration was created before this, follow these steps:
Log in as an Admin or Consent Manager.
Navigate to Cookie Consent.
Select Configurations.
Create or edit a Consent Manager Configuration.
Under Advanced Settings, toggle the Google Consent Mode switch on.
Save and Publish the configuration.
Starting January 16, 2024, Google AdSense, Ad Manager, and AdMob require publishers to use a CMP certified by Google and integrated with the IAB's Transparency and Consent Framework (TCF) when serving ads to users in the EEA or UK.
To enable IAB TCF 2.2:
Access your configuration in Osano and enable the IAB EU TCF 2.x Framework.
Note: If you opt not to use the IAB TCF 2.2 framework, your banner must include a link to Google's privacy page and language explaining that data is collected for the purpose of personalizing and measuring the effectiveness of advertising. Your banner must also include an affirmative (opt-in) consent option.
To add the required Google Privacy link: go to Additional Link Text in your Cookie Consent Manager settings and choose Google Privacy Policy from the list.
Link: https://business.safety.google/privacy/
⚠️ PLEASE MAKE SURE THE DATALAYER LOADS BEFORE YOUR OSANO SCRIPT ⚠️
Important: New configurations have the Google Consent Mode (GCM) setting enabled by default. If GCM is enabled while Osano is in Discovery/Listener mode, or the required GCM dataLayer is not on your site, Osano will inject a denied-consent value which can skew GA4 data and cause unexpected behavior. Disable the Google Consent Mode setting until the GCM dataLayer is added to your site and Osano is running in a live mode (Permissive or Strict).
This setup applies to Google Ads, Floodlight, Google Analytics, and Conversion Linker tags deployed directly via gtag.js or through Google Tag Manager (GTM).
Steps:
Enable Google Consent Mode in Osano.
Complete the next step only when osano.js is in a live mode — Permissive or Strict.
Add the following dataLayer code to your website before Osano's JavaScript executes:
<script>
window.dataLayer = window.dataLayer ||[];
function gtag(){dataLayer.push(arguments);}
gtag('consent','default',{
'ad_storage':'denied',
'analytics_storage':'denied',
'ad_user_data':'denied',
'ad_personalization':'denied',
'personalization_storage':'denied',
'functionality_storage':'granted',
'security_storage':'granted',
'wait_for_update': 500
});
gtag("set", "ads_data_redaction", true);
gtag("set", "url_passthrough",true);
</script>Note: Add this script directly to the HTML before osano.js loads. If loading the dataLayer within GTM (not recommended), ensure this code fires before any other Google tags.
Note: Remove this dataLayer code if you disable the Google Consent Mode integration to prevent issues with tracking and analytics reporting.
Execution order on your website:
Google Consent Mode dataLayer — sets default consent state
Osano.js — manages consent changes and sends updates
Google Applications — Google tags respond to consent signals
For advanced use cases such as region-specific behavior and URL passthrough, Google's API documentation provides further steps. Osano automates many of these configurations, reducing manual setup.
You may adjust ad_storage and analytics_storage values to 'granted' for opt-in scenarios. Osano will manage all consent communication with Google.
Osano's consent categories map to Google's as follows:
Osano | Google Consent Mode Categories |
|---|---|
Marketing |
|
Analytics |
|
Personalization |
|
Essential |
|
When users opt out of a category in Osano, the corresponding Google consent setting changes from granted to denied.
The setup approach you choose determines how Google tags behave before a user interacts with the consent banner. This maps directly to Google's published distinction between Basic and Advanced Consent Mode.
Osano-Centric Setup — Basic Consent Mode
Google scripts and cookies are classified within the Osano admin portal by their actual function (e.g., Google Analytics = Analytics). Osano blocks these tags from loading until the user grants consent. No data is sent to Google before consent is given — not even the default consent state.
This is the most compliant setup and is recommended by Osano. You can view Google's documentation on Basic Consent Mode here.
Google-Centric Setup — Advanced Consent Mode
Google scripts and cookies are classified as "Essential" within the Osano admin portal (e.g., _ga = Essential). This allows Google tags to load immediately when a user opens the page. Google then operates in a cookieless state, sending cookieless pings for modeling purposes, until the user grants consent via the Osano banner — at which point full data collection resumes.
IMPORTANT: This setup option renders the Osano "No Fines, No Penalties" Guarantee null and void.
Feature | Basic Consent Mode (Osano-Centric) | Advanced Consent Mode (Google-Centric) |
|---|---|---|
Tag loading | Blocked until user grants consent | Loads immediately; defaults set to |
Data transmission | No data sent before consent | Cookieless pings sent before consent; full data after |
Consent states | Set after user interaction | Defaults to |
Tag behavior after consent | Loads and executes only on consent | Adjusts based on user consent choice |
Conversion modeling | General model | Advertiser-specific model (more detailed) |
You can view more about Basic vs Advanced setup on Google's site here.
What is Google Tag Gateway?
Google Tag Gateway (GTG) is a Google-managed infrastructure that delivers Google tag scripts to your users via a Google-hosted CDN. It is designed to improve tag reliability and first-party data collection.
How GTG affects consent sequencing
When a Google tag is enrolled in GTG through one-click CDN injection, the tag script is delivered by Google's CDN independently of the script order you configure on your page. This means a GTG-enrolled tag may load before your consent defaults and Osano script execute — even when your page is otherwise correctly configured. This is the most common cause of late consent signals that cannot be resolved by reordering scripts alone.
For more details on how GTG works, see Google's GTG documentation.
How to verify if a tag is enrolled in GTG
Open Google Tag Manager and navigate to the container where the tag is configured.
Select the tag and look for a "Google tag settings" panel.
Check whether automatic configuration or a GTG-related enrollment option is enabled.
Refer to Tag Manager Help: Access Your Tag Settings for step-by-step guidance.
Also check at the Google Ads or GA4 account level — GTG enrollment can be applied there independently of GTM.
What to do if a tag is enrolled in GTG
If you detect a late consent signal and the affected tag is enrolled in GTG, reordering scripts on your page will not resolve the issue. Advanced Consent Mode (also referred to as U+C — unconsented and consented) is the recommended solution for GTG-enrolled tags.
Unlike Basic Consent Mode, Advanced Consent Mode does not block the tag script from loading. Instead, it allows the tag to operate in a cookieless state and respond to consent signals via the data layer — an approach that is fully compatible with GTG, including manual GTG configurations.
Choose one of the following approaches:
Option A — Enable Advanced Consent Mode with Data Transmission Controls and Global Consent Defaults (Recommended)
Switch to the Google-Centric (Advanced) setup described above. In your Google Ads or GA4 account, configure Data Transmission Controls to restrict data transmission when consent has not been granted, and set Global Consent Defaults to reflect your desired default consent state for regions where the banner does not appear. See Google's Data Transmission Controls documentation for setup guidance.
Option B — Migrate tags into a GTM container deployed via GTG
If you are running Google tags outside of GTM, migrate them into a GTM container and deploy that container via GTG. This gives you control over consent sequencing through GTM's tag firing rules. See Google's guidance on deploying GTM via GTG.
Option C — Configure GTG manually
If you need to set up GTG without one-click CDN injection, manual GTG configuration lets you control when and how the tag script is imported — restoring the correct load order (consent defaults → Osano → Google tags). See Google's manual GTG setup documentation.
Note: Option A is the approach most compatible with GTG out of the box and the one Osano recommends if you do not want to change your current GTG enrollment or tag structure.
Please refer to Google's documentation of all cookies used by Google products for additional context.
Scripts: analytics.js, gtag.js, floodlight.js, securepubads.js
Cookies: _ga, _gid, _gat, IDE, NID, ANID, DSID, FLC
When consent is denied, associated Google tags deployed via gtag.js or Google Tag Manager will adjust their behavior accordingly. In all cases, pings may include:
Functional information — Timestamp, User-Agent, Referrer
Aggregate/non-identifying information — Whether the current or a prior page included ad-click information in the URL (e.g., GCLID/DCLID)
ad_storage='denied':
No new advertising cookies may be written
No existing first-party advertising cookies may be read
Third-party cookies previously set on google.com and doubleclick.net may be sent in request headers (limited to spam and fraud purposes)
Google Analytics will not read or write Google Ads cookies; Google signals will not accumulate data
IP addresses are used to derive country of origin but are never logged and are immediately deleted
The full page URL is collected, including ad-click information (e.g., GCLID/DCLID)
ad_storage='denied' + ads_data_redaction=true:
No new advertising cookies may be written; no existing ones may be read
Requests are routed through a different domain to avoid third-party cookies being sent in headers
Ad-click identifiers in consent and conversion pings are redacted
Page URLs with ad-click identifiers are redacted
analytics_storage='denied':
Will not read or write first-party analytics cookies
Cookieless pings will be sent to Google Analytics for basic measurement and modeling purposes
Verify execution order: Ensure the Google Consent Mode dataLayer executes before osano.js, and that all subsequent Google scripts execute after both.
Use a fresh incognito or private window for all checks below — this avoids cached consent from previous sessions. If given the option, ensure "Block third-party cookies" is turned off to simulate a normal browsing session.
Inspect the data layer:
Open your browser's Developer Tools, go to the Console tab, and type dataLayer. Before consent is granted, you should see:
Arguments(3)
0: "consent"
1: "default"
2: {ad_storage: "denied", analytics_storage: "denied"}After granting consent, you should see:
Arguments(3)
0: "consent"
1: "update"
2: {analytics_storage: "granted", ad_storage: "granted"}Verify tags are firing correctly:
Use GTM's preview mode or the Google Tag Assistant browser extension to confirm that the appropriate tags are firing on your page before and after consent.
Test cookie behavior:
Before granting consent, confirm that cookies like _ga, _gid, and _gat are not being set. Go to Applications > Storage > Cookies in Developer Tools and check. If these cookies appear before consent, you are likely loading Google scripts through an inline script such as analytics.js, which does not support Consent Mode.
If you have completed all of the steps above and something still seems off, contact Osano support. As a Google-certified CMP partner, we can review your setup, provide recommendations, and assist with any escalations to Google needed to resolve the issue.