Salesforce

OnetrustActiveGroups - Using the Data Layer Object

« Go Back
Information
OnetrustActiveGroups - Using the Data Layer Object
UUID-66bcaaf1-c7ca-5f32-6760-c75a1337c226
Article Content

A data layer is a JavaScript object that is used to pass information from your website to whatever tag manager you utilize. You can then use the information found in the data layer to populate variables and create triggers to fire or not fire scripts the drop cookies based on user consent. The OneTrust Cookie Consent data layer object to use to do this is OnetrustActiveGroups.

Rather than referencing variables, transaction information, page categories, and other important signals scattered throughout your page, some tag managers are designed to easily reference information that is included in the data layer. How you will implement this will vary from tag manager to tag manager.

OneTrust Cookie Consent populates a data layer object OnetrustActiveGroups with the cookie categories that the user has consented to.

Once the banner script is implemented on the page, you will be able to call OnetrustActiveGroups from the console using developer tools in a browser and see which cookie category IDs are currently active.

CC_DL1.png

For example, a website using a script with an opt-in consent model configured, on initial page load only the Strictly Necessary category ID would be within OnetrustActiveGroups.

CC_DL2.png

If the user accepted all categories, all category IDs would populate in OnetrustActiveGroups, and with the appropriate triggers set up cookies associated with all the category IDs would be dropped on the browser.

CC_DL3.png

Perhaps the user only accepted the Functional cookie category. The data layer object would contain the category IDs associated with the Strictly Necessary and Functional cookie categories.

CC_DL4.png

The data layer will be an essential tool in testing the Cookie Consent implementation. You can check which category IDs the user is opted into and ensure the correct tags are firing or not firing based on the consent.

Note

You can find your cookie category IDs under Categorizations > Categories.

If you use custom category IDs, these IDs will populate in the data layer object.

Only the categories that are associated with the script will populate in the data layer object. So if you do not have cookies categorized in a particular category for a domain, that category will not show up in the preference center or in the data layer object.

Bundle Group IDs (An ID associated with a header group configured on your template), if used, will also populate in the data layer object. You should not use Bundle Group IDs to trigger scripts or tags to fire or not fire, only use cookie category IDs.

 
 
Article Visibility
36,769
Translation
English
Checked

Powered by