Skip to content

Collecting Consent with Usercentrics

Before jumping into any code, let's review some basic rules for collecting user consent:

In general, you are free to decide when to collect consent from your users. e.g. Right after app launch, after a demo game, during user activation, etc.

There are only 2 requirements you need to follow to be compliant with data protection:

Requirement 1

Do NOT enable any data tracking from 3rd party services/SDKs before a user has given explicit consent. This would otherwise be a breach of data protection regulations, which can result in heavy fines.

Requirement 2

Don't forget Requirement 1.

Integrating Usercentrics

First, from Usercentrics/Prefabs, drag the Usercentrics Prefab into your Scene.

Drag & Drop

Automatic Init

Use Case

Use Automatic Init to present the banner automatically when a scene starts. This integration only supports using our Usercentrics UI, which can be customized via our Configuration Dashboard. For a custom integration, please continue to Custom Init.

  1. Enable Auto Initialize in the Inspector Tab. When the Scene is shown for the first time, the consent banner will appear automatically when needed. Enable AutoInit

  2. Done! 🚀 Please continue to Apply Consent.

Custom Init

Use Case

Use Custom Init to have more control over the behaviour of the banner and the collected consent. This integration supports creating your own Banner, which can unlock a much higher performance for opt-in rates.

Disable Auto Initialize

For a custom integration, please make sure Auto Initialize is disabled.

  1. Import Usercentrics to the Scene

    using Unity.Usercentrics;

  2. On Scene start, call Initialize() from a Usercentrics instance. On success, evaluate status.shouldCollectConsent.

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

    Handling status.shouldCollectConsent

    shouldCollectConsent will let you know if you should present the banner. e.g If consent has never been collected, or if the banner needs to be shown again do to changes on your configuration.

    If consent has already been collected, you can simply apply the consent given, which will be available in status.consent

  3. Present the Consent Banner when status.shouldCollectConsent is TRUE.


Use our out-of-the-box UI component, that owns all the complexity of compliance, and can be customized via our Configuration Dashboard. Continue to UsercentricsUI.


Build your own Banner

Build a Banner that fits your game design language, and let us take care of the rest. Continue to Build your own UI.

Own UI

Only for IAB TCF 2.0 certified customers

Currently you can only use this solution if you are building a Banner that adheres to the IAB's TCF 2.0 Standard. For this you will need to be certified as a CMP by the IAB.