UsercentricsCore API
Initialization
Init
isReady
Completion Blocks |
Type |
Notes |
status |
UsercentricsReadyStatus |
Provides information needed to know what action to take next. Show CMP banner to collect consent or apply already collected consent. |
error |
Error |
Error object with non-localized description. |
Reset
Resetting the SDK
Use reset()
to clean all local storage and release the initialized instance. You will need to initialize the SDK again after a reset. Make sure you validate the expected behaviour, before using reset in production.
Features
restoreUserSession
Input |
Type |
Notes |
controllerID |
String |
A Usercentrics generated ID, used to identify a specific user. |
onSuccess |
Callback |
SDK has restored the user's consent attached to the controllerID provided. See Restore User Session |
onFailure |
Callback |
Handle non-localized error |
getUserSessionData
changeLanguage
Input |
Type |
Notes |
language |
String |
Language for content to be loaded on. e.g. "en", "de", "fr". |
onSuccess |
Callback |
Re-render your UI, as usual with the CMP data. Content now will be on the new language. |
onFailure |
Callback |
Handle non-localized error |
Always change language before rendering your UI
If you call this method after the UsercentricsUI has already been created, the new language will not be applied.
getABTestingVariant
setABTestingVariant
Build your own UI
getCMPData
acceptAll
Input |
Type |
Notes |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
denyAll
Input |
Type |
Notes |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
saveDecisions
Input |
Type |
Notes |
decisions |
[UserDecision] |
List of every service's templateID and the consent as a Bool. |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
Interaction Analytics
Track
Input |
Type |
Notes |
event |
UsercentricsAnalyticsEventType |
Track analytics events for Custom UI |
Events
[iOS] Event |
[Android] Event |
Notes |
.cmpShown |
.CMP_SHOWN |
The banner was displayed to the user. It doesn't matter which layer. |
.acceptAllFirstLayer |
.ACCEPT_ALL_FIRST_LAYER |
The Accept All button was pressed from the first layer. |
.denyAllFirstLayer |
.DENY_ALL_FIRST_LAYER |
The Deny All button was pressed from the first layer. |
.saveFirstLayer |
.SAVE_FIRST_LAYER |
The Save button was pressed from the first layer. Save is mainly used for granular decisions. |
.acceptAllSecondLayer |
.ACCEPT_ALL_SECOND_LAYER |
The Accept All button was pressed from the second layer. |
.denyAllSecondLayer |
.DENY_ALL_SECOND_LAYER |
The Deny All button was pressed from the second layer. |
.saveSecondLayer |
.SAVE_SECOND_LAYER |
The Save button was pressed from the second layer. Save is mainly used for granular decisions. |
.imprintLink |
.IMPRINT_LINK |
The Imprint link/button was pressed. |
.moreInformationLink |
.MORE_INFORMATION_LINK |
The More Information link/button was pressed. This button is usually used to navigate from first layer to second layer. |
.privacyPolicyLink |
.PRIVACY_POLICY_LINK |
The Privacy policy link/button was pressed. |
TCF 2.0 Specific Methods
getTCFData
Outputs |
Type |
Notes |
TCFData |
TCFData |
IAB's Transparency & Consent CMP Content. See IAB Data Source |
getTCString
setCMPId
Inputs |
Type |
Notes |
CMPId |
Int32 |
When builing your own UI for TCF 2.0. You need to pass the CMPID given to you by the IAB, in order for your solution to be compliant. |
acceptAllForTCF
Input |
Type |
Notes |
fromLayer |
Enum |
Layer in which consent was collected: firstLayer: First banner layer. secondLayer: Second banner layer. |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
denyAllForTCF
Input |
Type |
Notes |
fromLayer |
Enum |
Layer in which consent was collected: firstLayer: First banner layer. secondLayer: Second banner layer. |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
saveDecisionsForTCF
Input |
Type |
Notes |
tcfDecisions |
[TCFUserDecision] |
List of every purpose and specialFeature with values for consent and legitimate interest as Bool and respective Vendors. |
fromLayer |
Enum |
Layer in which consent was collected: firstLayer: First banner layer. secondLayer: Second banner layer. |
decisions |
[UserDecision] |
List of every service's templateID and the consent as a Bool. |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
CCPA Specific Methods
getUSPData
saveDecisions
Input |
Type |
Notes |
isOptedOut |
Bool |
Pass the user's response to the statement: "Do Not Sell My Personal Information". True: Do not track or sell user's information. False: You are allowed to track and sell user's information. |
consentType |
Enum |
Explicit: Consent was collected from a explicit action from the user. e.g. Button action. Implicit: Consent was collected without a explicit action of the user. e.g User can close or ignore the banner without giving a choice. Please make sure you consult with your Data Protection Officer before using this case. |
Helpers
shouldCollectConsent
Outputs |
Type |
Notes |
shouldCollectConsent |
Bool |
True, if consent has never been collected or some service has changed thus requiring a consent update. False, if consent has been collected and no update is required. |
getConsents
getControllerId
Outputs |
Type |
Notes |
controllerID |
String |
A Usercentrics generated ID, used to identify a specific user. See Restore User Session |
Objects
UsercentricsOptions
Property |
Type |
Notes |
settingsID |
String |
A Usercentrics generated ID, used to identify a unique CMP configuration. |
defaultLanguage |
String |
Selected based on our language selection hierarchy. This property defines the language used to render the banner. e.g. "en", "de", "fr". |
version |
String |
To freeze the configuration version shown to your users, you may pass a specific version here. You may find an overview of all versions in the Admin Interface under Configuration > History > Settings History > Version (Column) or Implementation > Script Tag > Version History. e.g. "3.0.4". Passing "latest" (default) will fetch the latest version of your CMP configuration. Passing "preview" will fetch the latest draft of your CMP configuration. |
timeoutMillis |
Int |
Timeout for network requests in milliseconds. We do NOT recommend overwriting this field unless absolutely necessary or for debugging reasons, as well as using any values under 5,000 ms. Default is 10,000 ms (10s). |
loggerLevel |
Enum |
Provides a set of logs for operations being executed in the SDK. debug: includes every other level, warning: non-problematic operations, error: relevant logs to any blocking problems and none (default). |
rulesetId |
String |
A Usercentircs generated ID, used to identify a bundle of CMP configurations to be used depending on the user's location. |
consentMediation |
Bool |
Enable Consent Mediation, an automated way to pass consent to 3rd party frameworks. |
UsercentricsReadyStatus
Property |
Type |
Notes |
shouldCollectConsent |
Bool |
True, if consent has never been collected or some service has changed thus requiring a consent update. False, if consent has been collected and no update is required. |
consents |
[UsercentricsServiceConsent] |
List of Services with consent choices. |
UsercentricsServiceConsent
Property |
Type |
Notes |
templateId |
String |
ID used to match a service with frameworks running on your app. |
status |
Bool |
Consent status given to this specific service. |
dataProcessor |
String |
Name of entity processing the data that was collected via this service. |
version |
String |
Legal template version. See Service Settings. |
UsercentricsCMPData
Property |
Type |
Notes |
settings |
UsercentricsSettings |
CMP settings and content properties needed to render your own UI. See Building your own UI. |
services |
[UsercentricsService] |
List of services. |
categories |
[UsercentricsCategory] |
List of categories. |
userLocation |
UsercentricsLocation |
Object exposing user's general location: regionCode, countryCode and countryName. |
legalBasis |
LegalBasisLocalization |
Object containing Legal Basis localization data. |
activeVariant |
Enum |
Provides active Legal Framework: default solution for GDPR, LGPD, etc., ccpa solution for ccpa (California/US), tcf solution for IAB's Transparency & Consent Framework 2.0. |