How it works
In this section you will find the JavaScript commands allowing you to interact with the CMP on your site.
Dernière mise à jour
In this section you will find the JavaScript commands allowing you to interact with the CMP on your site.
Dernière mise à jour
Sirdata CMP provides you with a list of standard commands documented in the IAB Tech Lab CMP JavaScript API.
All the commands are executed through the API function __tcfapi
.
The version
parameter is the TCF specification version (= 2).
You will find in the table below the list of events that can be triggered by the CMP:
Command
Callback
Parameter
Description
ping
function(PingReturn, success)
-
Returns information about the CMP loading status and the GDPR application mode.
getTCData
function(TCData, success)
vendorIds (int array) - optionnal List of vendor IDs from the Global Vendor List for which consent is required. If defined, TCData will only include vendors from this list. Otherwise, all vendors from the Global Vendor List will be returned.
Returns user TC Data.
getVendorList
function(GlobalVendorList, success)
vendorListVersion (int) - optionnel
Global Vendor List version to fetch. If undefined, the version used by Sirdata CMP is returned. If value is LATEST, the latest available version is returned. If value is invalid, GlobalVendorList will be null and success
will be false.
Returns the Global Vendor List containing the purposes and vendors participating in the Transparency & Consent Framework.
addEventListener
function(TCData, success)
-
Add a JavaScript function to call with TC Data whenever a CMP event occurs.
removeEventListener
function(success)
listenerId (int) Listener ID to remove.
Remove a listener previously added with the addEventListener command.
Event
Description
tcloaded
This event status is triggered when the CMP is loaded, a valid TC String is available and the UI is not surfaced.
cmpuishown
This event status is triggered when the UI is surfaced or re-surfaced. If there's no existing TC String for the user, the CMP creates a TC String with all legitimate interest signals set to true
and all the consent signals set to false
.
useractioncomplete
This event status is triggered whenever a user has confirmed or re-confirmed their choices and the updated TC String is ready to be surfaced.
cmpuiclosed
This event status is triggered when a user closes the surfaced UI by clicking on the close button (if enabled) and thus the current TC String is unmodified by the CMP.