UI Methods
The script globally adds the SibboCMP object. This object includes the following methods:
init
Loads all configurations and checks if the interface needs to be displayed:
Example with HTTPS protocol:
- SibboCMP.init(configuration, boolean, boolean);
Example with HTTP protocol:
- SibboCMP.init(configuration, boolean, boolean, configuration 2);
openBanner
Display the initial CMP banner.
- SibboCMP.openBanner(true);
openBannerIfNoTCS
Display the initial CMP banner when using the bannerHidden configuration property: true if there is no consent string saved in local storage or cookies.
- SibboCMP.openBannerIfNoTCS();
isOpen
Returns true if CMP is visible, and false if not.
initialBannerHasToRefloatCheck
Returns true if CMP needs to redisplay the initial banner, and false if not. This is used when the bannerHidden configuration property is true, in conjunction with the methods open/openBanner/openBannerIfNoTCS.
- SibboCMP.initialBannerHasToRefloatCheck();
close
Hides the CMP interface:
sendKeyPressEvent
Method to send from the client the keydown event to the CMP, used with customKeydown property in configuration. This method can be used when there are conflicts between the keydown listeners of the device and the CMP.
With the property customKeydown: true, the CMP will not listen to keydown event and receive it from the application with this method.
- SibboCMP.sendKeyPressEvent(event);

All methods except SibboCMP.init can only be used after the CMP has been initialized correctly.
Methods to obtain consent
To obtain consents, we use the method __tcfapi with various commands such as 'addEventListener', 'getInAppTCData', and 'getOtherVendorConsents' as we'll see below. The old command 'getTCData' is obsolete and should be replaced with 'addEventListener' to obtain the consent string.
Retrieve consent string
To obtain the user's consent string, you need to call the addEventListener command:

The CMP runs on a TV device, ES6 JavaScript features like arrow functions, const, let, etc., cannot be used. ES5 must be used instead.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.tcString;
- console.log(consent);
- } else {
- // do something else
- }
- });
Get consent for VENDORS NOT INCLUDED IN IAB (custom CMP SIBBO command)
To obtain consent for vendors not included in IAB, you need to call the command getOtherVendorConsents:

The CMP runs on a TV device, so ES6 JavaScript features like arrow functions, const, let, etc., cannot be used. ES5 must be used instead.
To obtain consents from all vendors not included in IAB:
- __tcfapi("getOtherVendorConsents", 2, function(otherVendorConsents, success) {
- if (success) {
- console.log(otherVendorConsents);
- } else {
- console.error('Error: could not get otherVendorConsents')
- }
- });
To obtain consent for a specific vendor not included in IAB, you need to use the cookieName property in the configuration to identify it. For example, for the vendor Cynapsis Interactive GmbH, its cookieName is cynapsisConsent:
- __tcfapi("getOtherVendorConsents", 2, function(otherVendorConsents, success) {
- if (success) {
- var cynapsis = otherVendorConsents.cynapsisConsent;
- console.log(cynapsis);
- } else {
- console.error('Error: could not get otherVendorConsents')
- }
- });
Obtaining consents examples
All the information generated by the CMP is stored in the tcData object of the addEventListener function. Below are some examples of the type of information that can be obtained:
Get the consent of a purpose
To get the consent of a purpose (e.g. purpose with ID 10):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.purpose.consents[10];
- console.log(consent);
- }
- });
Get the consent of a purpose based on legitimate interest
To get the consent of a purpose based on legitimate interest (e.g. purpose with ID 10):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.purpose.legitimateInterests[10];
- console.log(consent);
- }
- });
Get the consent of a vendor's purpose
To get the consent of a vendor's purpose (e.g. vendor with ID 565):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.vendor.consents[565];
- console.log(consent);
- }
- });
Get the consent of a vendor's purpose based on legitimate interest
To get the consent of a vendor's purpose based on legitimate interest (e.g. vendor with ID 565):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.vendor.legitimateInterests[565];
- console.log(consent);
- }
- });
Get the consent of a publisher's purpose
To get the consent of a publisher's purpose (e.g. publisher's purpose with ID 10):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.publisher.consents[10];
- console.log(consent);
- }
- });
Get the consent of a publisher's purpose based on legitimate interest
To get the consent of a publisher's purpose based on legitimate interest (e.g. publisher's purpose based on legitimate interest with ID 10):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.publisher.legitimateInterests[10];
- console.log(consent);
- }
- });
Get the consent of a publisher's custom purpose
To get the consent of a publisher's custom purpose (e.g. publisher's custom purpose with ID 1):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.publisher.customPurpose.consents[1];
- console.log(consent);
- }
- });
Get the consent of a publisher's custom purpose based on legitimate interest
To get the consent of a publisher's custom purpose based on legitimate interest (e.g. publisher's custom purpose based on legitimate interest with ID 1):

The CMP is running on a TV device, you cannot use javascript ES6: arrow functions, const, let, etc. You must use javascript ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.publisher.customPurpose.legitimateInterests[1];
- console.log(consent);
- }
- });
Get the consent of a special feature
To get the consent of a special feature (e.g. special feature with ID 1):

El CMP se ejecuta en un dispositivo de TV, no se puede usar javascript ES6: funciones flecha, const, let, etc. Se debe usar ES5.
- __tcfapi('addEventListener', 2, function(tcData, success) {
- if(success) {
- var consent = tcData.specialFeatureOptins[1];
- console.log(consent);
- }
- });