Osano and Google Tag Manager

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. 

  • Download THIS GTM TEMPLATE
  • In Google Tag Manager, go to "Templates"  and make a new template 
  • Import the Osano GTM Template - This template will load your Osano CMP based on your customer id and your config Id. Please be sure that it does so.
    • Your customer ID and config ID can be found in your osano.js - ex. https://cmp.osano.com/2sUBzx7jhdAfu6J2kkS/8e59878644-886f-4a9b-a90f-7e96a47aa604/osano.js
      • Example Customer ID: 2sUBzx7jhdAfu6J2kkS
      • Example Config ID: 8e59878644-886f-4a9b-a90f-7e96a47aa604

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

  • Create the new trigger and assign it to listen to the events dispatched by this template: 
    • Custom Event
      • osano__cm-loaded
    • Some custom events
      • Event Equals = osano__cm--load_success
      • Event Equals = osano__cm--load_failure

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. 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.