Skip to content

Applying Consent

Now that you have collected consent, let's make sure to respect the user's choices by applying consent to each SDK.

IMPORTANT: Please review EVERY vendor's documentation to understand how each SDK expects consent to be passed.

DO NOT assume consent is passed automatically to every SDK. Even if you are using the TCF standard or our Consent Mediation feature, please test and verify that consent is reaching the target SDKs.

First, we need a way to match the 3rd party technologies declared in your configuration, with the SDKs running in your Game.

The first time you launch the app with the Usercentrics SDK, no consent will have been collected and status.shouldCollectConsent returned in isReady will be TRUE, letting you know that you should collect consent by showing the banner. Once a user has responded, a userResponse will be returned on the banner callback, which will contain the consent object.

Usercentrics.Instance.ShowFirstLayer(<UsercentricsLayout>, (userResponse) => {
    applyConsent(userResponse.consents);
});

As early as possible on any future app launch

In any future initialization after collecting consent for the first time, you will already have a consent status stored on device, and you will only need to apply it as early as possible in the app cycle. In this case, the callback of the initialization will return FALSE for status.shouldCollectConsent, and you may apply consent directly.

Usercentrics.Instance.Initialize((status) => {
    if (status.shouldCollectConsent) {
        // Collect Consent
    } else {
        applyConsent(status.consents);
    }
},(errorMessage) => {
    // Failure: Returns non-localized error
});

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:

TCF Vendors

When using third party services that are certified as TCF Vendors, you will need to declare these services via the Global Vendor List (GVL) tab, in the Service Settings section of your TCF configuration.

GVL

Given you have selected your TCF Vendors in the GVL and published the changes, when a user provides consent, the SDK will generate an encoded string with the consent for these vendors according to the TCF 2.2 standard, called:

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.

In most cases, the Vendor SDK might automatically pull the TCString, and apply consent to itself automatically. In case the vendor SDK requires you to pass the TCString programmatically, you may use:

Usercentrics.Instance.GetTCFData((tcfData) => {
    var tcString = tcfData.tcString;
});

Consent for Non-IAB vendors NEEDS to be applied programmatically

Non-TCF Vendors

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.

TemplateID

We will be using this ID to match every declared service with it's SDK.

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.

Regulation dedicated APIs

Please note that most APIs are dedicated for a specific regulation. e.g. GDPR for Europe, CCPA/CPRA for 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.

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;
        }
    }
}