How it works
In this section you will find the JavaScript commands allowing you to interact with the CMP on your site.
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.
__tcfapi
1
window.__tcfapi(command, version, callback, parameter);
Copied!
The version parameter is the TCF specification version (= 2).
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.

PingReturn

1
{
2
gdprApplies: *Boolean*,
3
cmpLoaded: *Boolean*,
4
cmpStatus: *String*,
5
displayStatus: *String*,
6
apiVersion: '2.0',
7
cmpVersion: *Integer*,
8
cmpId: *Integer*,
9
gvlVersion: *Integer*,
10
tcfPolicyVersion: *Integer*
11
}
Copied!

TCData

1
{
2
tcString: [base64url-encoded] *String*,
3
addtlConsent: *String*,
4
tcfPolicyVersion: *Integer*,
5
cmpId: *Integer*,
6
cmpVersion: *Integer*,
7
gdprApplies: *Boolean*,
8
evenStatus: *String*,
9
cmpStatus: *String*,
10
isServiceSpecific: *Boolean*,
11
useNonStandardStacks: *Boolean*,
12
publisherCC: *String*,
13
purposeOneTreatment: *Boolean*,
14
outOfBand: {
15
allowedVendors: {
16
*vendorId*: *Boolean*,
17
?
18
},
19
disclosedVendors: {
20
*vendorId*: *Boolean*,
21
?
22
}
23
},
24
purpose: {
25
consents: {
26
*purposeId*: *Boolean*,
27
?
28
},
29
legitimateInterests: {
30
*purposeId*: *Boolean*,
31
?
32
}
33
},
34
vendor: {
35
consents: {
36
*vendorId* : *Boolean*,
37
?
38
},
39
legitimateInterests: {
40
*vendorId* : *Boolean*,
41
?
42
}
43
},
44
specialFeatureOptins: {
45
*specialFeatureId*: *Boolean*,
46
?
47
},
48
publisher: {
49
consents: {
50
*purposeId*: *Boolean*,
51
?
52
},
53
legitimateInterests: {
54
*purposeId*: *Boolean*,
55
?
56
},
57
customPurpose: {
58
consents: {
59
*customPurposeId*: *Boolean*,
60
?
61
},
62
legitimateInterests: {
63
*customPurposeId*: *Boolean*,
64
?
65
}
66
},
67
restrictions: {
68
*purposeId*: {
69
*vendorId* : *Integer*,
70
?
71
},
72
?
73
}
74
}
75
}
Copied!

GlobalVendorList

1
{
2
gvlSpecificationVersion: *Integer*,
3
vendorListVersion: *Integer*,
4
tcfPolicyVersion: *Integer*,
5
lastUpdated: *String*,
6
purposes: {
7
*purposeId*: {
8
id: *Integer*,
9
name: *String*,
10
description: *String*,
11
descriptionLegal: *String*,
12
},
13
?
14
},
15
specialPurposes: {
16
*specialPurposeId*: {
17
id: *Integer*,
18
name: *String*,
19
description: *String*,
20
descriptionLegal: *String*,
21
},
22
?
23
},
24
features: {
25
*featureId*: {
26
id: *Integer*,
27
name: *String*,
28
description: *String*,
29
descriptionLegal: *String*,
30
},
31
?
32
},
33
specialFeatures: {
34
*specialFeatureId*: {
35
id: *Integer*,
36
name: *String*,
37
description: *String*,
38
descriptionLegal: *String*,
39
},
40
?
41
},
42
stacks: {
43
*stackId*: {
44
id: *Integer*,
45
name: *String*,
46
description: *String*,
47
purposes: [
48
*Integer*,
49
?
50
],
51
specialFeatures: [
52
*Integer*,
53
?
54
],
55
},
56
?
57
},
58
vendors: {
59
*vendorId*: {
60
{
61
id: *Integer*,
62
name: *String*,
63
purposes: [
64
*Integer*,
65
?
66
],
67
legIntPurposes: [
68
*Integer*,
69
?
70
],
71
flexiblePurposes: [
72
*Integer*,
73
?
74
],
75
specialPurposes: [
76
*Integer*,
77
?
78
],
79
features: [
80
*Integer*,
81
?
82
],
83
specialFeatures: [
84
*Integer*,
85
?
86
],
87
policyUrl: *String*,
88
usesCookies: *Boolean*,
89
cookieMaxAgeSeconds: *Integer*,
90
usesNonCookieAccess: *Boolean*,
91
deviceStorageDisclosureUrl: *String*
92
},
93
?
94
}
95
}
Copied!

Events

You will find in the table below the list of events that can be triggered by the CMP:
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.
Last modified 7mo ago