Osano and Google Tag Manager

Google Tag Manager Installation

Installing the Osano.js

After creating and publishing your configuration, the "Get Code" button will become active. This button will provide you with the osano.js. 


To install, simply copy and paste the osano.js into the header <head> for all pages you wish to monitor. Ensure that the osano.js is the first script that loads on your site. 

Osano is platform AND Tag Manager agnostic. This means that, in general, the code can be added to the <head> of any site and can be utilized without having to do any additional configuration within Google Tag Manager or other Tag Manager solutions. We recommend that the osano.js be loaded without the use of Google Tag Manager where possible to ensure compliance.

If possible, we recommend testing in a staging/pre-production environment. If your pre-production environment has different tags than your production environment, it will be beneficial to test in "Permissive" mode before switching into "Strict". 

**If GTM must be utilized to deploy the osano.js, ensure that it is the FIRST script to execute on the page (outside of GTM). If scripts load prior to the osano.js, there is no way for those scripts/cookies to be blocked. See further instructions below: "Trigering Osano via Google Tag Manager"**

Creating and Publishing your Configuration

Creating a consent management implementation is simple and takes just a few minutes. 

  • Navigate to the "Consent Management" tab in Osano, and create a new site profile. 
  • In the site profile, you'll add at a minimum:
    • The Configuration Name 
    • The Root Domain 
    • The Data Storage and Sharing Policy URL
  • Create Configuration 
  • Publish Configuration

Once published, use the "get code" button to copy your osano.js and paste it into the header <head> for all pages you wish to monitor. 

Ensure that the osano.js is the first script that loads on your site. 

Triggering Osano via Google Tag Manager (Using Osano Template)

While it is possible to trigger Osano via Google Tag Manager, it is recommended that the Osano script is loaded outside of GTM in the site <head>. If, however, you must implement Osano via GTM, you will need to follow the steps below:

Even loaded via GTM, Osano must be the first script to execute on the page. To enforce this, you will need to create a Custom Event/Trigger within GTM to fire after Osano loads that will trigger all subsequent tags. 


  • Create a new tag, and set it up using your newly created template. 
  • Trigger this tag on "All Pages."


  • Ensure your template has the following permissions. If it does not already exist, add it. 


Triggering All Other Scripts

To function appropriately, Osano must be the first script to execute. It is imperative that Osano executes BEFORE any other script executes in order for it to block subsequent scripts.

Option 1: Utilize Google's Consent Initialization Trigger for Osano

The Consent Initialization trigger is designed to help you ensure that all consent settings are honored before any other triggers fire. 
Set this trigger for the Osano tag. 

Read more about this trigger HERE

Option 2: 

Ensure all scripts await the Osano script execution before being placed.

Example: In advanced settings, ensure that the Osano tags fire BEFORE any other 3rd party tags. 


Option 3:

  • Create the new trigger and assign it to listen to the events dispatched by this template: 
    • Custom Event
      • osano__cm-load_.*
    • This trigger fires on 
      • All Custom Events


Note: You can also set up consent listeners in a custom tag by hooking into Osano’s public API (linked)

  • Create a new "Custom HTML" tag 
  • Use window.Osano.cm.addEventListener to add your own custom events to the dataLayer and listen for osano-cm-initialized. Once initialized, all subsequent tags can be triggered.