Integration

Gravito CMP emits “gravito:tcfv2:client” events. Events indicate the UI actions and points when the user has given or denied the consents and rest of the tags can either trigger or not.

The event types are:

ActioneventTypeTrigger
CMP loadedcmploadedWill be fired every time cmp loads, irrespective of whether the UI is shown or not.
Consents not setconsent-not-setWill be fired when the user has not given his consents. i.e. Cookie does not exist.
Consents given previouslyopt-in:previouslyWill be fired when user has provided consents using cmp in their previous sessions. i.e. cookie exists
CMP UI resurfacedopt-in:previously:outdatedWill be fired when publisher decides to resurface the CMP even when cookie exists.
“3rd party vendors” click on 1st layerlayer1:show-vendorsUser clicks on “vendors” or “partners” link on 1st layer of CMP
“Settings” click on 1st layerlayer1:show-settingsUser clicks on “settings” button on the 1st layer of CMP
Layer 2 closedlayer2:back-to-layer1User clicks on “close” or “x” on 2nd layer of CMP
Custom settings confirmed by clicking “Accept selected”layer2:opt-in:selectedUser clicks on “Accept selected” on 2nd layer of CMP
“Accept all” clicked on layer 1layer1:opt-in:allUser clicks on “Accept all” button on 1st layer
“Accept all” clicked on layer 2layer2:opt-in:allUser clicks on “Accept all” button on 2nd layer
“Reject all” clicked on layer 2layer2:opt-out:allUser clicks on “Reject all” button on 2nd layer
CMP UI closedcmpui:closedCMP UI closes because of user actions
Parent site visible without CMP UIlayer2:back-to-site

Now you could set e.g. TMS to trigger further activities after it receives event with types “layer?:opt-in:all” or “layer2:opt-in:selected”. The latter option might require further processing of the settings.

You can access the data stored to TCF consent string by calling

window.gravitoCMP.consentHandler.decode()

If the end user has provided consents to gravito CMP then this function will return the decoded consent data, in case consents have not been provided then this function will return a null value.

Current state

Just for accessing the consents on various levels :

window.gravitoCMP.currentState

Example of listening events and currentState object

(function() { 
    document.addEventListener('gravito:tcfv2:client', function (event) { 
        console.log(event); 
        if(gravitoCMP.currentState) {
        	console.log(gravitoCMP.currentState.customPurposes); 
        	console.log(gravitoCMP.currentState.nonTCFVendors);
        }
    }, true); 
})();

Setting up an event listener on Google Tag Manager

You need to define following:

  1. Custom HTML, call it e.g. “CMP events”
  2. Variable, call it e.g. “CMP event proxy”
  3. Variable, call it e.g. “consentLevel”
  4. Trigger, call it e.g. “CMP opt-in event”

1) You can set up simple event listener on GTM with following code as custom tag:

<script>
(function() { 
    document.addEventListener('gravito:tcfv2:client', {{CMP event proxy}}, true); 
})();
</script>

2) Define new variable CMP event proxy, type being javascript:

function() {
  return function(event) {
    
    var consentLevel = 0;
    if(event.detail.purposeConsents[0] == 1) { consentLevel = 1; }
    
    window.dataLayer.push({
      event: 'custom.event.cmp.' + event.detail.eventType,
      'custom.gtm.originalEvent': event,
      'consentLevel':consentLevel
    });
  };
}

This tracks only purpose 1 (store and access data on the device) having consent enabled. If you need more granularity to triggers you can add more checks that append to consentLevel:

function() {
  return function(event) {
    
    // consider this simplified/descriptive example, there are more efficient ways to implement the same
    var consentLevel = "";

    for(i=0;i<event.detail.purposeConsents.length;i++) { 

  	  if(event.detail.purposeConsents[i]=="1") { consentLevel = consentLevel+"a"; } 
  	  if(event.detail.purposeConsents[i]=="2") { consentLevel = consentLevel+"b"; }
  	  if(event.detail.purposeConsents[i]=="3") { consentLevel = consentLevel+"c"; } 
  	  if(event.detail.purposeConsents[i]=="4") { consentLevel = consentLevel+"d"; }
  	  if(event.detail.purposeConsents[i]=="5") { consentLevel = consentLevel+"e"; } 
  	  if(event.detail.purposeConsents[i]=="6") { consentLevel = consentLevel+"f"; }
  	  if(event.detail.purposeConsents[i]=="7") { consentLevel = consentLevel+"g"; } 
  	  if(event.detail.purposeConsents[i]=="8") { consentLevel = consentLevel+"h"; }
  	  if(event.detail.purposeConsents[i]=="9") { consentLevel = consentLevel+"i"; } 
  	  if(event.detail.purposeConsents[i]=="10") { consentLevel = consentLevel+"j"; }
  	
	  }
        
    // optional : checks non-tcf consents
    if(window.gravitoCMP.currentState.nonTCFVendors[0]) { if(window.gravitoCMP.currentState.nonTCFVendors[0].consent === true) { consentLevel=consentLevel+"k"; }}
    if(window.gravitoCMP.currentState.nonTCFVendors[1]) { if(window.gravitoCMP.currentState.nonTCFVendors[1].consent === true) { consentLevel=consentLevel+"l"; }}
    if(window.gravitoCMP.currentState.nonTCFVendors[2]) { if(window.gravitoCMP.currentState.nonTCFVendors[2].consent === true) { consentLevel=consentLevel+"m"; }}
    // ... add as many you have on your setup ... //
    
    window.dataLayer.push({
      event: 'custom.event.cmp.' + event.detail.eventType,
      'custom.gtm.originalEvent': event,
      'consentLevel':consentLevel
    });
  };
}

Code blocks above are pushing the event data to dataLayer for GA and other tags to consume.

3) Define new variable “consentLevel”, type being datalayer variable, with default value 0 (simple case above) or without default value (more complex case with consentLevel with abc… values)

4) Trigger for calling other tags after consent has been given

  • Create new trigger,
  • Choose “Custom event” as type
  • Define event name as “cmp.*opt-in”, enable regex matching
  • Choose “some custom events”
  • Define the rule to look for “consentLevel” variable and value to be greater than 0 (simple case) OR
  • Define the rule to look for “consentLevel” variable and value to contain “a”, “b” or whatever consent you need to use to trigger tags

Testing and debugging. Easiest way to test that your setup works it should is to set up custom HTML tag with console logging or similar and set the triggere to “Marketing consent” or whatever you have named your triggers.

Resurfacing the CMP 2nd layer

CMP automatically binds to elements with class that is defined within the configuration for managing the CMP settings. Alternavitely the 2nd layer of CMP can be resurfaces by following:

window.gravitoCMP.openPreferences()

Documentation

Getting started

Frequently Asked Questions

Frequently Asked Questions (FAQ) - Gravito Intelligent CMP and TCF 2.2 CMP Banner. 1. What is Gravito? Gravito is a Consent Banner provider for websites. It offers both TCF (Transparency & Consent Framework 2.2 ) certified Consent Management Platforms (CMPs) for...

Register

Before you can start using Gravito features you will need to register yourself in the Gravito portal. Head to https://admin.gravito.net and enter your email you want to use with Gravito: After submission you will receive an email with PIN code, enter that to...

Support

All support cases and issues are handled by the support team of Gravito or by technology partners. In case you need support please send us email at support<at>gravito.net Be part of our community? Join us on our Discord Channel here

Gravito Intelligent CMP

Getting Started

Gravito Intelligent CMP is a consent management solution that helps to collect consent for data collection, analytics, targeting, personalization and whatever your business needs to fulfil legal or regulatory terms. 💡 NoteHave you registered with Gravito yet? Please...

Setup and Design

Gravito Intelligent CMP Setup can be done using Gravito CMP Configurator on Gravito's Admin Portal. Go to CMP>>Gravito CMP configurator. You can choose the language of your choice when creating your own CMP Config Do you want to try out how our configuration is? You...

GTM Template

Gravito CMP now can be deployed using GTM Template. In order to use this feature, while creating the configuration for Gravito CMP you will have to check the "Is GTM?" flag in the basic section of the configuration wizard. If the config is created using the "is GTM? "...

Release Notes

Gravito Intelligent CMP release notes. Version 4.0.7 Multiple Language Support: Light CMP now supports multiple languages within the user interface, offering a more inclusive experience for users worldwide. Users can access a language selection dropdown within the CMP...

Advanced Features

Here are the links to the advanced features supported by Gravito Intelligent CMP Customization Advanced Customization Options Latest Gravito Configuration example (json) Headless CMP using Gravito Integrations How to integrate events emitted by the Gravito Intelligent...

Gravito TCF 2.2 CMP

Getting Started

Gravito CMP provides a TCF 2.2 compliant consent management platform. With Gravito you can customize the look and feel of your CMP so that it blends good with your website. Gravito TCF 2.2 CMP is also listed as one of the Google Certified TCF CMP's To get started you...

Setup and Design

Gravito TCF 2.2 CMP Setup can be done using TCF CMP Configurator on Gravito’s Admin Portal. Go to CMP>>TCF configurator.

Mobile apps

TCF CMP implementation on mobile apps can take two different strategies: You have TCF CMP already configured and set up for your website or you are planning to have such AND your application is made with webviews (= content is displayed on webviews and 3rd party...

Release Notes

Version 4.0.9 Release Notes ( Release date 08/02/2024) New Features: Added support for GCMV2: Gravito TCF CMP now includes support for GCMV2 Bug Fixes: Fixed an issue with the IAB CMP validator: A bug has been resolved where the CMP was not being correctly validated...

Advanced features

Here are few of the advanced features of Gravito TCF 2.2 CMP Integration How to integrate with events emitted by Gravito TCF 2.2 CMP? Customization Latest Gravito TCF 2.2 CMP Configuraton example (json)

Gravito SDK

Getting Started

The Gravito SDK ( Latest Version 2) is a tool that allows developers to communicate with the Gravito APIs and deploy both light CMP and TCF CMP. It includes functions for interacting with the Gravito first party backend solution and is used by all major services...

Release Notes

Release Notes (V 2.0.12) (08/02/2024) New Features: SDK now emits separate events when the user has clicked "reject all" previously. This enhancement provides more granular insights into user interactions, allowing for better tracking and analysis of user behavior....

Version 2 (Latest)

Using SDK V2 To use Gravito's SDK you should have the Gravito config added to your site. Make sure you also have settings section added inside your config. You can get the config from the Gravito Admin Portal 👉Looking for an older version of Gravito SDK? You can find...

Gravito API

Getting Started

Gravito API is a powerful tool when it comes to collecting consent statistics while allowing you to connect multiple ids that you use in your setup and give it more persistence. One of the key features of the Gravito API, the Gravito ID Connector is enabled using the...

Setup and Validation

First Party domain means the domain your website operates. e.g. website.com. To avoid third party cookies being blocked (occurs already on many browsers) you can configure the CMP to set the cookies under first party domain or you can use Gravito's first party API to...

Version 3 (Latest)

First party API / Microprofile As discussed in the previous version 2, most common use for first party microprofile is to store CMP consents and other metadata on it. In version 3 we have added a whole new set of features to manage observations, consents and key rings...

Version 2

First party API / Microprofile Most common use for first party microprofile is to store CMP consents and other metadata on it. That configuration is automatically generated by CMP configurator, just select “with backend” option when generating the deployment script...

Microprofile

Microprofile which relies on Gravito Firstparty API v3 is in Beta testing Gravito Microprofile is sort of a synonym to first party API. First party API was initially developed as simple microservice to help with setting first party cookie to hold CMP settings and...

Other  Features

Cookie Scanner

Cookie Scanner Gravito allows you to scan your web pages for cookies dropped. Gravito classifies cookies on your webpage as ones dropped before accepting the consent and ones after accepting the consent. This way there is a clear understanding of what is happening on...

GVL Comparison

Gravito allows you to compare global vendor list versions. You can get specific details like which vendors were updated, added as well as deleted from the comparison tool You can find the GVL comparison tool under the Features -> GVL Updates menu You can choose the...

Prebid User Id Module

Gravito has a user module in prebid js, customers now can use Gravito's first party service and prebid js usermodule to use a persistent first party id in prebid's bit stream. More details in the each section below. Getting Started Setup and Validation Version 1...

Try it out

Playbooks

Quick guides to get started with various deployment scenarios. Deploy basic consent management banner and wire the tags on it Register/login to https://admin.gravito.net Navigate to CMP > Gravito CMP configurator > New Configuration Create configuration, you...