SmartTV & HbbTV: Events

SmartTV & HbbTV: Events

IAB predefined events

Once the CMP has been loaded, the __tcfapi method is created, which is used to retrieve the consent string, get consent for a specific purpose, etc. The full definition and all available standard API commands can be found at the following link.

The CMP launches a series of events predefined by the IAB to detect the following:
  1. CMP and consent tring loaded (event 'tcloaded')
  2. CMP is shown (event 'cmpuishown')
  3. Consent string saved (event 'useractioncomplete')
These events are caught by the __tcfapi method with the 'addEventListener' command.

Example:
The CMP is running on a TV device, ES6 javascript cannot be used: functions arrow, const, let, etc. ES5 must be used. 
  1. var tcLoadedCallback = function(tcData, success) {                                                                                                        
  2.  
  3.   if(success && tcData.eventStatus == 'tcloaded') {

  4.     // do something with tcData.tcString

  5.     __tcfapi('removeEventListener', 2, function(success) {

  6.       if(success) {
  7.         // listener removed
  8.       }

  9.     }, tcData.listenerId);

  10.   } else {
  11.     // do something else
  12.   }

  13. }

  14. __tcfapi('addEventListener', 2, tcLoadedCallback);

Sibbo custom events

The CMP launches a series of custom events to detect the following:
  1. 'sibbo-init' This event is dispatched in the document element when the CMP loader has finished the initialization and __tcfapi is now available
  2. 'sibbo-close' This event is dispatched in the window element when the CMP closes
  3. 'sibbo-tcs-saved' This event is dispatched in the document element when the CMP saves the TCS
  4. 'sibbo-main' This event is dispatched in the document element when the CMP shows initial banner
  5. 'sibbo-purposes' This event is dispatched in the document element when the CMP shows purposes based  on consent view
  6. 'sibbo-purposesLegInt' This event is dispatched in the document element when the CMP shows purposes based  on legitimate interest view
  7. 'sibbo-vendors' This event is dispatched in the document element when the CMP shows vendors view
  8. 'sibbo-privacyPolicyThis event is dispatched in the document element when the CMP shows privacy policy view
  9. 'sibbo-cookiesPolicyThis event is dispatched in the document element when the CMP shows cookies policy view
  10. 'sibbo-privacyCookiesPolicyThis event is dispatched in the document element when the CMP shows privacy and cookies policy view
  11. 'sibbo-termsAndConditionsThis event is dispatched in the document element when the CMP shows terms and conditions view
  12. 'sibbo-additionalConsentProviders' This event is dispatched in the document element when the CMP shows Google's additional consent providers view
Examples:
The CMP is running on a TV device, ES6 javascript cannot be used: functions arrow, const, let, etc. ES5 must be used. 
  1. var sibboInitCallback = function() {
  2.   // CMP has been initialized
  3.   // do someting
  4. }

  5. document.addEventListener('sibbo-init', sibboInitCallback);

  1. var sibboCloseCallback = function() {
  2.   // CMP has closed
  3.   // do someting
  4. }

  5. document.addEventListener('sibbo-close', sibboCloseCallback);