Info
Content

CMP Events

In order to get notifications when certain events occur, you can use the following JavaScript Methods:

  • __cmp("addEventListener",["eventname",callableFunction,capture],null)
  • __cmp("removeEventListener",["eventname",callableFunction,capture],null)

The CMP can call the following events:

Event

Description

"init"

CMP code is loaded and the stub code has been removed. At this stage the CMP has no information about the consent yet.

"settings"

CMP finished loading its settings. If a consent string existed already, the consent data can now be read from the CMP.

"consentscreen"

CMP shows the consent screen

"consentscreenoff"

CMP removes the consent screen

"consent"

CMP has gathered consent or a preexisting cookie was found. Consent data can now be read from the CMP.

"consentapproved"

Visitor gave positive consent to all vendors/purposes

"consentrejected"

Visitor rejected all vendors and purposes

"consentcustom"

Visitor gave custom consent (accepts and rejections)


Event handler are defined as:

var handler = function (eventname, cmpobject){…} 

Example:

<script>
  function getInfos(e,o)
  { 
    /*... do something ...*/
  }
  __cmp("addEventListener",["consent",getInfos,false],null);
</script>
Back to top