This initializes AppConsent.
This method is ASYNCHRONOUS!
You must call the method with await.
To ensure proper operation, put the call to this method in a try/catch.
This method doesn't have a Promise
So it can't be used as such (promiseMethod.then().catch())
Your AppKey
force behavior as in a GDPR subject country
false, let the CMP check whether the user is subject to the GDPR of its region.
true, it considers the user to be subject to GDPR
force ATT handling (iOS only)
To display AppConsent by modal on top of your view.
To be notified when the user has entered his consent, don't forget to register with the callback.
false, displays the introduction screen as a modal only if necessary (subject to GDPR, consent not entered, consent period exceeded, etc.).
true, forces the display of the configuration screen (allowing users to enter/modify their consent)
Retrieve external ids from cache.
NOTE: this only returns the external ids present in the local storage, without checking them out from the backend, external ids are only synchronized after a call to present() or checkForUpdate().
String representation of all the external Ids in User Preferences in the following form : [:] for an empty value ["key1": "value1", "key2": "value2"] for a key/value data set
Send the external ids you have stored with setExternalIds to the server.
NOTE: the external ids are also saved automatically when calling present(), whether or not the notice is presented, or when calling checkForUpdate(). Saving ExternalIds with this method doesn't work unless there has been a previous consent registered with present(), so in most cases it is preferable to simply rely on present() or checkForUpdate() to save the ExternalIds.
AppConsent.setExternalIds({ myCustomID: 'xyz' })
.then((success: boolean) =>
console.log('🔥 setExternalIds => ' + success)
)
.catch((err: any) => console.log(err))
true
Store a set of external id allong the consent, the ids are synchornised with the consents upon calling present() or checkForUpdate(), so this should be called before calling present() or checkForUpdate().
NOTE: this overrides previously set ExternalIds in the local storage, but the change won't be synchronized with our backend untill a call to present() or checkForUpdate() is made.
true
Check if consent must be updated (new gvl version, new consentables…)
AppConsent.checkForUpdate()
.then((isNeedToUpdate: boolean) => {
console.log('isNeedToUpdate => ' + isNeedToUpdate);
// CMP needs to be displayed again to your users
AppConsent.present(false);
}).catch((err: any) => console.log(err));
Callback when user give its consent.
CAUTION: This function is not reliable on iOS. Prefer using consentAlreadyGiven().
AppConsent.consentGiven()
.then((success: boolean) => console.log('consentGiven => ' + success))
.catch((err: any) => console.log(err));
true if user saved their consent preferences.
Set consentables status with an iabId.
CAUTION: Key must be an iabId, not an objectId. Value must be an Integer: 0 (pending), 1 (allowed), -1 (denied)
NOTE: This method doesn’t send request to the server.
Set consentables status with extraId.
CAUTION: Key must be an extraId, not an objectId. Value must be an Integer: 0 (pending), 1 (allowed), -1 (denied)
NOTE: This method doesn’t send request to the server.
This is the main interface to interact with AppConsent API, it exposes typescript declarations to access Native libraries features.
Example