Ensighten
Ensighten and the OneTrust Script
Last Updated: Mar 11, 2021
If you use Ensighten to inject cookies on your website, you can set up Ensighten so the scripts are controlled by the consent preferences choices selected by site visitors.
This makes deployment easier than using the standard helper methods described in the Client-Side Cookie Management section of this guide. However, there are some differences in behavior because of how Ensighten functions.
This section explains how to set up Ensighten to integrate with your banner script.
This is not intended to be a complete guide to using Ensighten. For more detailed information about setting up and using Ensighten, consult official documentation provided by Ensighten.
How It Works
To pass data to Ensighten, the Cookie Compliance tool uses variables. It supports JavaScript variables and Data Layer variables. We recommend using the Ensighten Data Layer and Data Layer variables.
Cookie Compliance uses the existing dataLayer object or creates a new one if it doesn't already exist. If your site creates a dataLayer object, ensure that this does not overwrite the one created by the OneTrust script.
It adds a key named OnetrustActiveGroups with a value of a comma delimited string of the current active group ids as selected by the visitor (or the default setup). This key is repopulated on every page load once the script is executed.
For example, the data contained in the value might be ,C0002,C0003,C0004,
.
By creating an Ensighten Custom Variable and rules, you can make Ensighten tags only fire when specific consent groups are active.
Integration Steps
To add the banner to your site, use the insertScript()
function and add the OneTrust script.
var scriptSource = 'https://cdn.cookielaw.org/consent/XXXXXX-XXXX-XXXX-XXXXX.js';
Bootstrapper.insertScript(scriptSource)
Copy the highlighted part above and use it in the
insertScript()
function.
Updated 12 months ago