Skip to main content
All CollectionsFAQsCompliance and Data Governance
Retention.com Script and Cookie Compliance Tools
Retention.com Script and Cookie Compliance Tools
Updated over 3 months ago

Overview

Retention.com scripts are built with flexibility in mind, allowing customization and a seamless integration with a wide range of cookie compliance tools. Our scripts can be set-up to fire only when users have given the required consent, ensuring compliance with privacy regulations while maintaining smooth functionality across different platforms.

By following this guide, you'll learn how to configure the Retention.com script within Google Tag Manager (GTM) to ensure it respects user consent preferences for cookies and other tracking technologies. In this guide, we will walk you through how to integrate our script into a cookie compliance solution, using OneTrust as an example.


Requirements

  • Google Tag Manager (GTM) access

  • Cookie consent tool (e.g., OneTrust)

Prerequisites

  • Retention.com script installation via Google Tag Manager

  • Cookie Consent tool installation via Google Tag Manager

If you do not have Retention.com scripts installed via Google Tag Manager, please refer to our documentation here to get started.

You may also find documentation on how to install OneTrust via Google Tag Manager here.


General Guidelines for Integrating with Any Consent Tool

While we’ve used OneTrust as an example, the general principles outlined below can be applied to other consent management platforms like Cookiebot, TrustArc, etc. Our script can adhere to any compliance tool that works with Google Tag Manager and pushes consent information to the DataLayer.

  1. Ensure Your Consent Tool’s API is Accessible in GTM:

    • Verify that the consent tool provides an API or DataLayer push mechanism to expose the user's consent status. Common tools like OneTrust will push consent categories to the GTM DataLayer.

  2. Create a Data Layer Variable:

    • Set up a Data Layer Variable in GTM to capture the consent status pushed by your consent tool (e.g., consent categories like Strictly Necessary, Performance, Marketing).

  3. Create Custom Triggers Based on Consent:

    • Create custom triggers that evaluate the consent status and determine if the Retention script should fire or not. For example, if the user only consents to necessary cookies, marketing scripts will not fire.

  4. Configure Your Tags:

    • Apply the trigger to your Retention.com base script tag in GTM so that it only fires when the appropriate consent is provided.


Example: Using OneTrust for Consent Management

To illustrate the setup, below you can find general instructions on how Retention.com scripts can be configured to work with OneTrust.

For a comprehensive and detailed guide on using triggers with OneTrust, please refer to the official OneTrust documentation. It provides step-by-step instructions and best practices to help you implement and manage triggers effectively.


1. Confirm the OptanonConsent variable exists

  • In Google Tag Manager, Go to VariablesUser-Defined VariablesSearch for "OptanonConsent".

  • If the variable does not exist, please follow the instructions here to implement the variable.

2. Create a Trigger Based on the OptanonConsent variable

  • In Google Tag Manager, Go to TriggersNew → Set Trigger type as Page View.

  • Select Some Page Views and configure it to check if the OptanonConsent variable contains a specific category ID(s) (e.g., C0004 for targeting cookies).

  • Give the Trigger a name and save your changes.

🚨 You are responsible for determining which consent categories should activate the trigger in GTM. OneTrust typically defines four key consent categories:

  • C0001: Strictly Necessary Cookies

  • C0002: Performance Cookies

  • C0003: Functional Cookies

  • C0004: Targeting Cookies

Decide which of these categories must be accepted by the user for your specific trigger to fire in GTM. This ensures that your tags comply with user consent preferences.

To find the consent categories and associated IDs for your OneTrust app:
1) Go to the OneTrust application dashboard (app.onetrust.com)
2) From the left navigation bar select "Categorizations"
3) Select Categories from the top menu.


3. Update Retention.com Tags in GTM with New Trigger

  • In Google Tag Manager, locate the tag that contains the Retention.com base script.

  • Go to the Tag Triggering section and replace the current trigger with the newly created consent trigger.

  • Save your changes.


Testing Your Setup

  • Use GTM’s Preview mode to test whether the Retention.com script is firing as expected based on user consent.

  • Check the browser’s console to verify that the correct consent groups are being evaluated.

  • Please ensure you clear your cache and cookies when testing.

For the official and recommended approach, always refer to the OneTrust documentation and resources. The purpose of this guide is to demonstrate how Retention.com scripts can be modified in GTM using OneTrust as an example. Be sure to consult your cookie consent tool’s documentation for the most accurate and compliant implementation practices.

Did this answer your question?