
Updated: July 19th, 2018. This recipe installs a Cookie Consent Notification provided by OneTrust (you’ll need to paste your own code there, though) and sets up triggers that respect visitor’s consent and cookie preferences.
It is highly recommended that you read this guide which explains how to create a OneTrust Cookie Banner, set it up and successfully integrate into your current Google Tag Manager stack.
Important: this version of the cookie consent is not updated anymore. You should follow ONLY if you are using Onetrust since 2018 or even earlier. If you are a new user, use this recipe instead.
INSTRUCTIONS
- Create a free OneTrust account. It might take up to 48 hours to get it, so register as soon as possible. Here’s a form that you need to submit and after a while, you’ll get an email with the confirmation link.
- Download Container File
Download the container JSON file (right-click on the link and click “Save Link As” or “Save Target As” to save the JSON file to your computer). - Import JSON File into GTM
Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Read this blog post for more details about importing a container file. - Set up cookie consent notification, publish changes.
- Update all your tracking tags (which deal with personal data) in Google Tag Manager by adding one of 3 blocking triggers to them as an exception.
This needs to be done with every single tracking tag (which deals with personal information), including Google Analytics Pageview, Google Adwords Conversion Tag, etc.
If a tag is related to analytics (e.g. Google Analytics Event tag) then assign Blocking – Analytics Tracking is Not Allowed trigger as an exception. In case of Adwords tag, use Blocking – Marketing Cookies are Not Allowed trigger. You get the idea, right? Here’s how an updated tag triggering could look like of a Universal Analytics tag:
- Open GA Event – Cookie Consent Data For The Record tag and set the GA Tracking ID (or GA Settings Variable).
View all 30+ Google Tag Manager Recipes


