How to Maximize Data Collection with OneTrust & Consent Mode


This guide is for updating OneTrust + Elevar setups prior to November 2023

One Trust Consent setup after this time will have followed this setup guide, which provides the correct setup to maximize your data collection.


If you're using OneTrust with Elevar's Consent Mode and are seeing more ignored events due to lack of consent than you believe there should be, it may be that the OneTrust tag is not passing the consent values fast enough.

To make the Onetrust consent values load quicker, you can migrate the Onetrust script from loading in Google Tag Manager to being hard coded in your Shopify Theme.

Why? Tags in Google Tag Manager need to wait for Google Tag Manager itself to load first, before they can fire. By hard coding your OneTrust script at the top your Shopify theme, this ensures that your OneTrust script loads first. So by the time to rest of your tracking loads & looks for consent, the consent values are already present.

How to Move OneTrust from GTM to Shopify Theme

Add OneTrust Script to Theme

You'll want this script to appear before your Elevar snippets. It should be in the Head portion, as high as possible.

Here's OneTrust's article on Publishing and Implementing their Cookie Consent Scripts.

This will end up looking like the below:

Import OneTrust (for hard coded banner scripts) Container to GTM

Click here to be taken to the OneTrust (for hard coded banner scripts) pre-built tags.

Once you download the pre-built container, import the tags in Google Tag Manager. How do I do this?

This will update your existing "One Trust CMP" template.

Update Consent Key Settings

Update Consent Key Settings in “One Trust CMP” tag if cookies should be allowed prior to consent:

Delete OneTrust Update Watcher Tag

Publish Your Changes