The JENTIS-Consent-Engine is a JavaScript Software, which is loaded by the JENTIS System and handles all functionality and APIs at the frontend. The JENTIS-Consent-Enginge is not offering any GUI (consentbar). For GUI you have to see the JENTIS-Consent-Template documenation.

Example

You find an open source example of how to use the JENTIS consent engine here:

https://bitbucket.org/jentis/jentis.app.consent-html/src/master/

Please check out the GIT and use the *.html - Files from the /test - Folder to see how it works!

You will see this consentbar used at www.jentis.com.

Global Object

You can access all functions and events by the following object

jentis.consent.engine
JS

Listen to JENTIS-Consent-Engine Events

The JENTIS-Consent-Engine will decide in several situations. You can listen to this decisions by using the following events.

Synchronous generic Listener

You can listen to the JENTIS-Consent-Engine Events by the following window native event, if you are sure, that you write your listener before the JENTIS-Basic-Code is executed.

document.addEventListener('<eventname>', function (e)
{
    console.log(e.detail.<more info>);
});
CODE

The elements which are written within <…> are dynamic data which are defined by the following table.

Asynchronous special Listener

Sometime you will not be sure really being executed before the JENTIS-Basic-Trackingcode is executed. For exemple if you are using a external Tag Mangement System like Google Tag Manager. In this case you can use the following code to listen to one of the JENTIS-Consent-Engine Events.

jentis.consent.engine.addEventListener('<eventname>',function(e)
{
    console.log(e.detail.<more info>);
});
CODE

The advantage of this usage of the internal Event Listener is, if you missed the event, the JENTIS-Consent-Engine Object will remember this missed event and will call the callback function immediately.

Listen Best Practice

if(typeof window.jentis !== "undefined" && typeof window.jentis.consent !== "undefined" &&typeof window.jentis.consent.engine !== "undefined")
{
	//If the engine is allready loaded, we maybe missed the events, so we want to register at the engine instead of the document.
	var oEventBaseObject = window.jentis.consent.engine;			
}
else
{
	//No engine allready exists, so it is safe to register at the document.
	var oEventBaseObject = document;
}

//Now listen to the Init Event of the Consent Engine.
(function(oMe,oEventBaseObject){
    oEventBaseObject.addEventListener('jentis.consent.engine.init',function(e)
    {
		oMe.consentEngineReady = true;
		oMe.startTracking();
    });

})(this,oEventBaseObject);
CODE

At the following table you find all available events which are provided by the JENTIS-Consent-Engine.

Eventname

Description

more info

jentis.consent.engine.show-bar

This event means you should show the consentbar to the user so the user can make his descissions.

-

jentis.consent.engine.user-show-settings

This event means you should show the setting page regarding to vendors and consent because the user requestet it by himself.

-

jentis.consent.engine.vendor-change

At least one of the vendors consents had changed.

Object with all vendors and consent information

{
  "ga"    : true,
  "adw"   : false,
  "fb"    : true
}
CODE

jentis.consent.engine.vendor-add

At least one more positive consent was given.

Array with all vendors which have currently a positive consent

[
  "ga",
  "fb"
]
CODE

jentis.consent.engine.init

The JENTIS-Consent-Enginge is fully loaded and ready to work

-

jentis.consent.engine.minimal-consent-given

A minimal consent is given, means at least one vendor has a positive consent. This event triggers if the consent is given because the user is giving the consent right now through the consentbar or the consent was given by the user at a previous page.

-

jentis.consent.engine.no-consent-given

No consent is given, means at no vendor has a positive consent. This event triggers if the consent is given because the user is denying the consent right now through the consentbar or the consent was denied by the user at a previous page.

jentis.consent.engine.send-consent-data

Consent Data must be send to the server. Triggers every time if the engine wants to store the data persistently at the server.

Object with the Consent Data.

{
  "consentid"   : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "lastupdate"  : 36473882736,
  "vendors"     : {
      "ga"    : true,
      "adw"   : false,
      "fb"    : true
  },
  "vendorsChanged": {
    "ga"  : true
  }
}
CODE

Get Information from the JENTIS-Consent-Engine

To get the current status information from the JENTIS-Consent-Engine you have to use the following functions.

Function Name

Parameter

Return

Description

jentis.consent.engine.getVendorConsent

  • String: Id of the Vendor you want to get the status

Bool: true if the consent for the given vendor is given, false if there exists no consent.

Use this function to get the consent status for a single vendor. You have to know the Vendor-ID.

var bGoogleConsent = jentis.consent.engine.getVendorConsent("ga");
CODE

jentis.consent.engine.getAllConsents

-

Object of Vendor-Ids and bool per vendor: true if the consent for the given vendor is given, false if there exists no consent.

{
  "ga"    : true,
  "adw"   : false,
  "fb"    : true
}
CODE

Use this function to get all consent status for all vendors.

var aAllConsent = jentis.consent.engine.getAllConsents();
CODE

jentis.consent.engine.getConsentId

-

String The current used user-consent-id or false, if no consent yet decided.

Use this function to get the current consent-id of an user.

var sConsentId = jentis.consent.engine.getConsentId();
CODE

jentis.consent.engine.getVendorFullData

Object of vendor-ids followed by a object with the following data.

  • vendor

    • id

    • name

    • street

    • zip

    • country

      • iso

      • name

  • purpose

    • id

    • name

  • justification

    • id

    • name

  • description

{
  "ga" : {
    "status"  : true,
    "vendor" : {
      "id"      : "ga",
      "name"    : "Google Analytics",
      "street"  : "Google Street 1",
      "zip"     : "114011",
      "country" : {
        "iso"   : "us",
        "name"  : "United States of America"
      }
    },
    "purpose" : {
      "id"    : "stat",
      "name"  : "statistic"
    },
    "justification" : {
      "id"    : "consent",
      "name"  : "consent"
    },
    "description" : "bla bla bla bla bla"
  },
  "fb"  : {...}
}
JS

Most of the fields are self explaining. The status key contains, if you are allowed to send data to the vendor (true) or not (false). In case of justification “consent” true means the user has given a consent for this vendor. If there is another justification then “consent” the status will be true without having a consent from the user.

Use this function to get all information about the vendors in your wanted language.

oVendorInfo = jentis.consent.engine.getVendorFullData();
JS

jentis.consent.engine.getLastUpdateTime

-

The timestamp (UNIX Timestamp in microseconds) of the last consent update from the user.

Use this function to get the timestamp of the last Update from the user.

var iLastUpdate = jentis.consent.engine.getLastUpdateTime();
CODE

jentis.consent.engine.getTemplateConfig

Each template defines its own configuration data structure. This structure will be returned filled with the stored data.

Here is an example:

{
		consenext 	: "text bla bla bla",
		contact			: "contact bla bla",
		buttonagree		: "Alle akzeptieren",
		buttondeny		: "Ablehnen",
		buttonsettings	: "Einstellungen",
		importantlinks	: {
			"Impressum"		: "/impressum",
			"Datenschutz"	: "/datenschutz"
		}
		}
JS

Get the configuration data the administrator has stored for the template.

var oConf = jentis.consent.engine.getTemplateConfig();
JS

Push Information to the JENTIS-Consent-Engine

You can use several functions directly to push data and information to the JENTIS Consent Engine.

List of functions to push data and information

Because the JENTIS-Consent-Engine does not provide any GUI - templates or bridges have to use the supported APIs to push the following information to the JENTIS-Consent-Engine.

Function Name

Parameter

Return

Description

jentis.consent.engine.setNewVendorConsents

  • Object with the vendor-id as key and bool true if the consent was given and false if the consent was not given

    {
      "ga"  : true,
      "adw" : false,
      "fb"  : true
    }
    CODE

The ConsentId which was used to store the new consent status or false, if something went wrong

Use this function to set the total consent status

var sConsentId = jentis.consent.engine.setNewVendorConsents({
  "ga"  : true,
  "adw" : false,
  "fb"  : true
});
CODE

jentis.consent.engine.AcceptAll

-

The ConsentId which was used to store the new consent status or false, if something went wrong

Use this function to set a positive consent to each vendor.

var sConsentId = jentis.consent.engine.AcceptAll();
JS

jentis.consent.engine.DenyAll

The ConsentId which was used to store the new consent status or false, if something went wrong

Use this function to deny the consent to each vendor

var sConsentId = jentis.consent.engine.DenyAll();
CODE

jentis.consent.engine.userShowSettings

-

-

You must use this function if the user wants to show the setting page regarding to vendors and consents. You can use this function to open the setting page out of your consent bar and you must use it if you want to provide a link for example in your data protection description page or in your footer for the user to reset his settings.