Info
Content

Cross-Device Consent Sharing

ConsentManager supports Cross-Device Consent Shareing. In order to share consent information across multiple devices, the website/app needs to meet the following requirements:

  • The website/app needs to be able to identify the user across devices. This is usually done via a login on the website or app: Every time the user logs into the account, the (new) device can share the same consent information as all other devices of the same user.
  • Your platform (the one that stores the login of the user) needs to be able to store the consent information of the user on the server side. The consent information will be an alphanummeric string with up to 8kb size

General setup

In order to share the consent across multiple devices, the following steps will be performed:

  1. When the user visits the website or app first, no consent information is present and the user will be asked for consent.
  2. Once the user gives consent, the CMP will store the consent information on the users device and notify the website or app that new consent information is present.
  3. The website or app will retrieve/export the consent information from the CMP and store it in its own database along with the users profile.
  4. The next time the user visits the website or app, it will import the existing consent information into the CMP.

Web

In order export the consent information, the command __cmp('exportConsent') can be used. It will output the consent information as a base64 encoded websafe string.

In order to import the existing information, the command __cmp('importConsent','....') can be used. It will set the internal consent information and disable the consent screen.

As an alternative you can also pass the consent information via the URL using parameter ?cmpimport=... or #cmpimport=...

Please note: In order to avoid that the consent screen is shown, the command importConsent should be called immediatly after the CMP-Code. The CMP will queue the command and automatically import the consent information as a first step when loading the CMP.

Here is an simple example code that will perform the import, check for changes and export the consent data if necessary:

<script>  
  var userConsentInfo = '... insert consent data from users profile if present, otherwise empty ...';
  function storeConsent(eventname, o)
  {
   var c = __cmp("exportConsent");
   if(c !== userConsentInfo)
   {
    console.log('new consent data: ', c);
    userConsentInfo = c;
     //send new consent info to server in order to store it there
   }
  }
  __cmp('importConsent',userConsentInfo);
  __cmp('addEventListener', ['consent', storeConsent, false], null);
 </script>

App

For apps the procedure is the same as for web, only the functions/names are different.

Android

In order to export the consent information, please use

String consentData = CMPConsentTool.exportCMPData(this);

In order to import the consent information, please use

CMPConsentTool.importCMPData(this, "...data...");

iOS

Back to top