Applying Consent¶
Now that you have collected consent, let's make sure to respect the user's choices by applying consent to each SDK.
First, we need a way to match the 3rd party technologies declared in your configuration, with the SDKs running in the Game.
How to match a service with an SDK?¶
Every service (DPS) available in our database, such as:
- Google Firebase
- Unity Ads
- Adjust
- AppLovin
- Vungle
will have a unique templateID
to identify it. This ID can be found under Service Settings > Data Processing Services > Service Extended Information.
We will be using this ID to match every declared service with it's SDK.
When should you apply consent?¶
After collecting consent¶
It is a given that consent will only change if the banner is shown to the user and an action is taken. When using the UsercentricsUI, the callback will return the new values, and you will need to use it to apply consent:
Usercentrics.Instance.ShowFirstLayer(<UsercentricsLayout?>, (userResponse) => {
applyConsent(userResponse.consents);
});
After a new app launch¶
The first time you launch the app with the Usercentrics SDK, no consent will have been collected, and the status
returned in isReady
will let you know if you should collect consent.
However, in any future initialization after the first one, you will already have a consent status, and you will only need to apply it.
Usercentrics.Instance.Initialize((status) => {
if (status.shouldCollectConsent) {
// Collect Consent
} else {
applyConsent(status.consents);
}
},(errorMessage) => {
// Failure: Returns non-localized error
});
How to apply consent?¶
SDKs that access and process user and/or device data, are only allowed to do so, if the user has given explicit consent. In order to be compliant, please review every SDK in your Game for the following cases:
SDKs with a consent API¶
SDKs that support data privacy compliance, will provide an API to set the user's consent status. The API and it's behaviour will be documented by the SDK's provider.
e.g.
- Google Analytics for Firebase's Consent Mode
- Unity Ad's Privacy consent and data API
- AppLovin's Privacy API
Regulation dedicated APIs
Please note that most APIs are dedicated for a specific regulation. e.g. GDPR for Europe, CCPA for US/California, COPPA for children protection, etc. Make sure to review the documentation and apply the consent for the correct regulation.
To apply consent to these SDKs, identify the target SDK and implement the consent API as documented:
private void applyConsent(List<UsercentricsServiceConsent> consents){
foreach (var serviceConsent in consents) {
switch (serviceConsent.templateId) {
case "hpb62D82I": // Unity Ads Template ID
// UnityAdsConsentAPI.Enabled = service.consent.status;
break;
case "YYyyYyYYY": // Other SDK Template ID
// Pass consent to framework with service.status
break;
default:
// Log a warning if a service was not caught or do nothing
break;
}
}
}
Not all APIs are created equal
Please make sure you read through each documentation, as many providers might require other steps to fully be complaint.
SDKs without a consent API¶
For SDKs that track user/device data and do not offer a consent API, the only solution is to not initialize those SDKs, when a user did not provide consent.
private void applyConsent(List<UsercentricsServiceConsent> consents){
foreach (var serviceConsent in consents) {
switch (serviceConsent.templateId) {
case "x-XXXxXx": // Template ID
// Only initialize an SDK if consent has been given
if (service.status) { initializeSDK() }
break;
case "YYyyYyYYY": // Other SDK Template ID
//Initialize framework based on service.status
break;
default:
// Log a warning if a service was not caught or do nothing
break;
}
}
}
Using the IAB's TCF 2.0 standard¶
When using the TCF 2.0 standard, consent will be applied automatically to all IAB Vendors. Consent for Non-IAB vendors will need to be applied programmatically.
TC String
As specified by the IAB, the collected consent for IAB Vendors will be encoded into a TCString and stored locally in NSUserDefaults
(iOS) or SharedPreferences
(Android).
You may access these values with their specific Keys.
Alternatively, we have also enabled the method:
Usercentrics.Instance.GetTCFData((tcfData) => {
var tcString = tcfData.tcString;
});