Reference
This section is a comprehensive reference of the methods and events exposed by the Unity SDK that you can leverage in your application.
Always use Didomi.GetInstance() to get a reference to the Didomi SDK. Also make sure to always call the SDK after it is fully initialized (see OnReady)

AddEventListener

Add an event listener to catch events triggered by the SDK. Events listeners allow you to react to different events of interest. This function is safe to call before the Ready event has been triggered.
Requires SDK to be initialized
No.
Parameters
Name
Type
Description
eventListener
DidomiEventListener
The event listener. An instance of a subclass of DidomiEventListener
Returns
Nothing
Example
C#
1
2
private void RegisterEventHandlers()
3
{
4
DidomiEventListener eventListener = new DidomiEventListener();
5
eventListener.ConsentChanged += EventListener_ConsentChanged;
6
eventListener.HideNotice += EventListener_HideNotice;
7
eventListener.Ready += EventListener_Ready;
8
eventListener.ShowNotice += EventListener_ShowNotice;
9
eventListener.NoticeClickAgree += EventListener_NoticeClickAgree;
10
eventListener.NoticeClickMoreInfo += EventListener_NoticeClickMoreInfo;
11
eventListener.PreferencesClickAgreeToAll += EventListener_PreferencesClickAgreeToAll;
12
eventListener.PreferencesClickDisagreeToAll += EventListener_PreferencesClickDisagreeToAll;
13
eventListener.PreferencesClickVendorSaveChoices += EventListener_PreferencesClickVendorSaveChoices;
14
eventListener.PreferencesClickViewVendors += EventListener_PreferencesClickViewVendors;
15
eventListener.PreferencesClickSaveChoices += EventListener_PreferencesClickSaveChoices;
16
eventListener.PreferencesClickPurposeAgree += EventListener_PreferencesClickPurposeAgree;
17
eventListener.PreferencesClickPurposeDisagree += EventListener_PreferencesClickPurposeDisagree;
18
eventListener.PreferencesClickVendorAgree += EventListener_PreferencesClickVendorAgree;
19
eventListener.PreferencesClickVendorDisagree += EventListener_PreferencesClickVendorDisagree;
20
21
Didomi.GetInstance().AddEventListener(eventListener);
22
}
23
24
private void EventListener_ConsentChanged(object sender, ConsentChanged e)
25
{
26
// The consent status of the user has changed
27
}
28
29
private void EventListener_HideNotice(object sender, HideNotice e)
30
{
31
// The notice is being hidden
32
}
33
34
private void EventListener_Ready(object sender, Ready e)
35
{
36
// The Didomi SDK is ready
37
}
38
39
private void EventListener_ShowNotice(object sender, ShowNotice e)
40
{
41
// The notice is being shown
42
}
43
44
private void EventListener_NoticeClickAgree(object sender, NoticeClickAgree e)
45
{
46
// Click on agree on notice
47
}
48
49
private void EventListener_NoticeClickMoreInfo(object sender, NoticeClickMoreInfo e)
50
{
51
// Click on learn more on notice
52
}
53
54
private void EventListener_PreferencesClickAgreeToAll(object sender, PreferencesClickAgreeToAll e)
55
{
56
// Click on agree to all on preferences popup
57
}
58
59
private void EventListener_PreferencesClickDisagreeToAll(object sender, PreferencesClickDisagreeToAll e)
60
{
61
// Click on disagree to all on preferences popup
62
}
63
64
private void EventListener_PreferencesClickSaveChoices(object sender, PreferencesClickSaveChoices e)
65
{
66
// Click on save on the purposes view on preferences popup
67
}
68
69
private void EventListener_PreferencesClickViewVendors(object sender, PreferencesClickViewVendors e)
70
{
71
// Click view vendors on purposes view on preferences popup
72
}
73
74
private void EventListener_PreferencesClickVendorSaveChoices(object sender, PreferencesClickVendorSaveChoices e)
75
{
76
// Click on save on the vendors view on preferences popup
77
}
78
79
private void EventListener_PreferencesClickPurposeAgree(object sender, PreferencesClickPurposeAgree e)
80
{
81
// Click on agree to a purpose on preferences popup
82
}
83
84
private void EventListener_PreferencesClickPurposeDisagree(object sender, PreferencesClickPurposeDisagree e)
85
{
86
// Click on disagree to a purpose on preferences popup
87
}
88
89
private void EventListener_PreferencesClickVendorAgree(object sender, PreferencesClickVendorAgree e)
90
{
91
// Click on agree to a vendor on preferences popup
92
}
93
94
private void EventListener_PreferencesClickVendorDisagree(object sender, PreferencesClickVendorDisagree e)
95
{
96
// Click on disagree to a vendor on preferences popup
97
}
98
99
Copied!
Event types
The following events are supported by the Didomi SDK:
Method
Description
ConsentChanged
When a consent is given or withdrawn by the user. Only triggered when the consent status actually changes (ie if the user saves consents without adding/removing any consent then this does not get called).
HideNotice
When the consent notice is hidden. If you have disabled our default consent notice to replace it with your own, you need to hide your custom notice when this event gets triggered.
ShowNotice
When the consent notice gets displayed. If you have disabled our default consent notices to replace them with your own, you need to show your custom notice when this event gets triggered.
NoticeClickAgree
When user clicks on agree on the notice
NoticeClickMoreInfo
When user clicks on learn more on the notice
PreferencesClickAgreeToAll
When user clicks on agree to all on the preferences popup
PreferencesClickDisagreeToAll
When user clicks on disagree to all on the preferences popup
PreferencesClickPurposeAgree
When user agree to a purpose on the preferences popup. (purposeId provided as a parameter)
PreferencesClickPurposeDisagree
When user disagree to a purpose on the preferences popup. (purposeId provided as a parameter)
PreferencesClickViewVendors
When user clicks on view vendors on the preferences popup
PreferencesClickSaveChoices
When user saves his choice on the preferences popup
PreferencesClickVendorAgree
When user agree to a vendor on the preferences popup. (vendorId provided as a parameter)
PreferencesClickVendorDisagree
When user disagree to a vendor on the preferences popup. (vendorId provided as a parameter)
PreferencesClickVendorSaveChoices
When user saves his choice on the vendors view on the preferences popup

DisableMockUI

Disable or enable the mock UI when testing in Unity Editor.
Android and iOS platform builds
This function has no effect for iOS or Android platform builds. It can safely be called in all environments and will only impact the Unity Editor.
Requires SDK to be initialized
No
Parameters
Name
Type
Description
disable
boolean
true to disable the mock UI
Returns
No return value
Example
C#
1
Didomi.GetInstance().DisableMockUI(true);
Copied!

GetDisabledPurposes

Get the list of purposes that have been disabled by the user.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Purpose>
A set of type Purpose containing the purposes disabled by the user.
Example
C#
1
Didomi.GetInstance().GetDisabledPurposes();
Copied!

GetDisabledPurposeIds

Get the list of purpose IDs that have been disabled by the user.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of purposes disabled by the user.
Example
C#
1
Didomi.GetInstance().GetDisabledPurposeIds();
Copied!

GetDisabledVendors

Get the list of vendors that have been disabled by the user.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Vendor>
An array of type Vendor containing the vendors disabled by the user.
Example
C#
1
Didomi.GetInstance().GetDisabledVendors();
Copied!

GetDisabledVendorIds

Get the list of vendor IDs that have been disabled by the user.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of vendors disabled by the user.
Example
C#
1
Didomi.GetInstance().GetDisabledVendorIds();
Copied!

GetEnabledPurposes

Get the list of purposes that have been enabled by the user.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Purpose>
An array of type Purpose containing the purposes enabled by the user.
Example
C#
1
Didomi.GetInstance().GetEnabledPurposes();
Copied!

GetEnabledPurposeIds

Get the list of purpose IDs that have been enabled by the user.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of purposes enabled by the user.
Example
C#
1
Didomi.GetInstance().GetEnabledPurposeIds();
Copied!

GetEnabledVendors

Get the list of vendors that have been enabled by the user.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Vendor>
A set of type Vendor containing the vendors enabled by the user.
Example
C#
1
Didomi.GetInstance().GetEnabledVendors();
Copied!

GetEnabledVendorIds

Get the list of vendor IDs that have been enabled by the user.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of vendors enabled by the user.
Example
C#
1
Didomi.GetInstance().GetEnabledVendorIds();
Copied!

GetJavaScriptForWebView

Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebView.
Inject the returned tag into a WebView with evaluateJavaScript.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
string
JavaScript code to embed in a WebView
Example
C#
1
Didomi.GetInstance().GetJavaScriptForWebView();
Copied!

GetPurpose

Get a purpose based on its ID.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
purposeId
string
ID of the purpose we want to get.
Returns
Type
Description
Purpose
A Purpose with ID purposeId found in the array of required purposes.
Example
C#
1
Didomi.GetInstance().GetPurpose("purpose-id");
Copied!

GetRequiredPurposes

Get the list of purpose that are required (automatically determined from the list of required vendors).
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Purpose>
A set of type Purpose containing the required purposes.
Example
C#
1
Didomi.GetInstance().GetRequiredPurposes();
Copied!

GetRequiredPurposeIds

Get the list of purpose IDs that are required (automatically determined from the list of required vendors).
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of required purposes.
Example
C#
1
Didomi.GetInstance().GetRequiredPurposeIds();
Copied!

GetRequiredVendors

Get the list of vendors that are required (determined from the configuration).
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<Vendor>
A set of type Vendor containing the required vendors.
Example
C#
1
Didomi.GetInstance().GetRequiredVendors();
Copied!

GetRequiredVendorIds

Get the list of vendor IDs that are required (determined from the configuration).
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Type
Description
ISet<string>
A set of type string containing the IDs of required vendors.
Example
C#
1
Didomi.GetInstance().GetRequiredVendorIds();
Copied!

GetText

Method used to get a dictionary/map based on the key being passed. These keys and texts are extracted from the notice content, preferences content and the texts property specified in the didomi_config.json file as described here https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
key
string
key associated to the dictionary that we want to get.
Returns
Type
Description
IDictionary<string,string>
Dictionary containing the translations for an specific key in different languages, with the form { "en:" "text in English", "fr": "texte en Français" }
Example
C#
1
Didomi.GetInstance().GetText("key");
Copied!

GetTranslatedText

Method used to get a translated text based on the key being passed.
The language and the source of this translated text will depend on the availability of the translation for the specific key.
The language being used will be either the selected language of the SDK (based on device Locale and other parameters) or the language specified by app developers as the default language being used by the SDK. The source can be either the didomi_config.json file, which can be either local or remote, or a file that is bundled within the SDK.
These are the attempts performed by the SDK to try to find a translation for the specific key:
  • Get translated value in user locale (selected language) from didomi_config.json (either local or remote).
  • Get translated value in default locale (from the config) from didomi_config.json (either local or remote).
  • Get translated value in user locale (selected language) from the Didomi-provided translations (bundled within the Didomi SDK).
  • Get translated value in default locale (from the config) from the Didomi-provided translations (bundled within the Didomi SDK).
If no translation can be found after these 4 attempts, the key will be returned.
App developers can provide these translated texts through the didomi_config.json file (locally or remotely) in 3 different ways:
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
key
string
key associated to the text that we want to get translated.
Returns
Translated text.
Example
C#
1
Didomi.GetInstance().GetTranslatedText("key");
Copied!

GetUserConsentStatusForPurpose

Get the user consent status for a given purpose. You must also check that the user has given consent to a vendor specifically before being able to load a vendor.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
purposeId
string
The ID of the purpose to check the user consent for.
Returns
A ConsentStatus object that indicates if the user has given consent or not to the specific purpose.
ConsentStatus.enable is returned if the user has given consent to the purpose. ConsentStatus.disable is returned if the user has denied consent.
ConsentStatus.unknown is returned if the consent status is not known yet. From a GDPR perspective, you'll want to treat it as ConsentStatus.disable (ie "no consent given") but it is helpful to know that the user has not interacted with the consent UI yet so that you can subscribe to events and wait for the consent information to be collected.
If consent is not required because GDPR does not apply to that user, this function will return ConsentStatus.enable.
Example
C#
1
Didomi.GetInstance().GetUserConsentStatusForPurpose("purpose-id");
Copied!

GetUserConsentStatusForVendor

Get the user consent status for a given vendor. You must also check that the user has given consent to some or all of the purposes required by a vendor before loading the vendor. The function getUserConsentStatusForVendorAndRequiredPurposes does all the required checks for you so it might be a better choice.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
vendorId
string
The ID of the vendor to check the user consent for. If you are checking an IAB vendor, pass the number as a string. If you are checking a custom vendor, prefix your vendor ID with c:.
Returns
A ConsentStatus object that indicates if the user has given consent or not to the specific vendor.
ConsentStatus.enable is returned if the user has given consent. ConsentStatus.disable is returned if the user has denied consent.
ConsentStatus.unknown is returned if the consent status is not known yet. From a GDPR perspective, you'll want to treat it as ConsentStatus.disable (ie "no consent given") but it is helpful to know that the user has not interacted with the consent UI yet so that you can subscribe to events and wait for the consent information to be collected.
If consent is not required because GDPR does not apply to that user, this function will return ConsentStatus.enable.
In Objective-C, the return value is an Int and not an Enum. It can take one of the following values:
  • ConsentStatusEnable
  • ConsentStatusDisable
  • ConsentStatusUnknown
Example
C#
1
// IAB vendors
2
Didomi.GetInstance().GetUserConsentStatusForVendor("1");
3
4
// Didomi vendors
5
Didomi.GetInstance().GetUserConsentStatusForVendor("google");
6
7
// Custom vendors
8
Didomi.GetInstance().GetUserConsentStatusForVendor("c:custom-vendor-id");
Copied!

GetUserConsentStatusForVendorAndRequiredPurposes

Get the user consent status for a given vendor. We use the list of purposes declared for the vendor to make sure that it has consent for all of them. The required purposes are automatically setup for IAB or Didomi vendors and you must specify the required purposes for your custom vendors when configuring the tag.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
vendorId
string
The ID of the vendor to check the user consent for. If you are checking an IAB vendor, pass the number as a string. If you are checking a custom vendor, prefix your vendor ID with c:.
Returns
A ConsentStatus object that indicates if the user has given consent or not to the specific vendor and all its required purposes.
ConsentStatus.enable is returned if the user has given consent. ConsentStatus.disable is returned if the user has denied consent.
ConsentStatus.unknown is returned if the consent status is not known yet. From a GDPR perspective, you'll want to treat it as ConsentStatus.disable (ie "no consent given") but it is helpful to know that the user has not interacted with the consent UI yet so that you can subscribe to events and wait for the consent information to be collected.
If consent is not required because GDPR does not apply to that user, this function will return ConsentStatus.enable.
In Objective-C, the return value is an Int and not an Enum. It can take one of the following values:
  • ConsentStatusEnable
  • ConsentStatusDisable
  • ConsentStatusUnknown
Example
C#
1
// IAB vendors
2
Didomi.GetInstance().GetUserConsentStatusForVendorAndRequiredPurposes("1");
3
4
// Didomi vendors
5
Didomi.GetInstance().GetUserConsentStatusForVendorAndRequiredPurposes("google");
6
7
// Custom vendors
8
Didomi.GetInstance().GetUserConsentStatusForVendorAndRequiredPurposes("c:custom-vendor-id");
Copied!

GetUserStatus

Get all the user consent status.
Returns
A UserStatus object describing all the available and computed user information.
Parameter
Type
Description
purposes.global.disabled
ISet<string>
Computed sets/lists of disabled IDs of purposes that have been chosen by the user regarding the consent or legitimate interest Legal Basis.
purposes.global.enabled
ISet<string>
Computed sets/lists of enabled IDs of purposes that have been chosen by the user regarding the consent or legitimate interest Legal Basis. Purposes considered as essential will be part of the enabled IDs.
purposes.consent.disabled
ISet<string>
Disabled IDs of purposes that have been explicitly chosen by the user regarding the consent Legal Basis.
purposes.consent.enabled
ISet<string>
Enabled IDs of purposes that have been explicitly chosen by the user regarding the consent Legal Basis.
purposes.legitimateInterest.disabled
ISet<string>
Disabled IDs of purposes that have been explicitly chosen by the user regarding the legitimate interest Legal Basis.
purposes.legitimateInterest.enabled
ISet<string>
Enabled IDs of purposes that have been explicitly chosen by the user regarding the legitimate interest Legal Basis.
purposes.essential
ISet<string>
IDs of purposes that are considered essential.
vendors.global.disabled
ISet<string>
Computed sets/lists of disabled IDs of vendors that have been chosen by the user regarding the consent or legitimate interest Legal Basis. This takes into account the consent and legitimate interest required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.global.enabled
ISet<string>
Computed sets/lists of enabled IDs of vendors that have been chosen by the user regarding the consent or legitimate interest Legal Basis. This takes into account the consent and legitimate interest required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.globalConsent.disabled
ISet<string>
Computed sets/lists of disabled IDs of vendors that have been chosen by the user regarding the consent Legal Basis. This takes into account the consent required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.globalConsent.enabled
ISet<string>
Computed sets/lists of enabled IDs of vendors that have been chosen by the user regarding the consent Legal Basis. This takes into account the consent required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.globalLegitimateInterest.disabled
ISet<string>
Computed sets/lists of disabled IDs of vendors that have been chosen by the user regarding the legitimate interest Legal Basis. This takes into account the legitimate interest required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.globalLegitimateInterest.enabled
ISet<string>
Computed sets/lists of enabled IDs of vendors that have been chosen by the user regarding the legitimate interest Legal Basis. This takes into account the legitimate interest required purposes linked to vendors. When computing this property, essential purposes will be considered as enabled.
vendors.consent.disabled
ISet<string>
Disabled IDs of vendors that have been explicitly chosen by the user regarding the consent Legal Basis.
vendors.consent.enabled
ISet<string>
Enabled IDs of vendors that have been explicitly chosen by the user regarding the consent Legal Basis.
vendors.legitimateInterest.disabled
ISet<string>
Disabled IDs of vendors that have been explicitly chosen by the user regarding the legitimate interest Legal Basis.
vendors.legitimateInterest.enabled
ISet<string>
Enabled IDs of vendors that have been explicitly chosen by the user regarding the legitimate interest Legal Basis.
userId
string
Didomi user id.
created
string
User choices creation date.
Example
C#
1
UserStatus userStatus = Didomi.GetInstance().GetUserStatus();
2
3
// Example: Enabled consent ids for vendors
4
ISet<string> enabledVendorsConsentIds = userStatus.GetVendors().GetConsent().GetEnabled();
Copied!

GetVendor

Get a vendor based on its ID.
Not available for IOS platform builds
This function is only exposed to Unity Android platform builds. It cannot be called from Unity IOS platform builds.
Requires SDK to be initialized
Yes.
Parameters
Name
Type
Description
vendorId
string
ID of the vendor we want to get.
Returns
Type
Description
Vendor
A Vendor with ID vendorId found in the array of required vendors.
Example
C#
1
Didomi.GetInstance().GetVendor("vendor-id");
Copied!

HideNotice

Hide the consent notice.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Nothing
Example
C#
1
Didomi.GetInstance().HideNotice();
Copied!

HidePreferences

Hide the preferences popup.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
Nothing
Example
C#
1
Didomi.GetInstance().HidePreferences();
Copied!

Initialize

Initialize the SDK. The initialization runs on a background thread to avoid blocking your UI. Use the onReady function to know when the initialization is done and the SDK is ready to be used.
Requires SDK to be initialized
No.
Parameters
Name
Type
Optional
Description
apiKey
string
No
Your API key
localConfigurationPath
string
Yes
The path to your local config file in your assets/ folder. Defaults to didomi_config.json if null.
remoteConfigurationURL
string
Yes
The URL to a remote configuration file to load during initialization. When provided, the file at the URL will be downloaded and cached to be used instead of the local assets/didomi_config.json. If there is no Internet connection available and no previously cached file, the local file will be used as fallback.
providerId
string
Yes
Your provider ID (if any). A provider ID is assigned when you work with Didomi through a third-party. If are not sure if you have one, set this to null.
disableDidomiRemoteConfig
bool
Yes
Prevent the SDK from loading a remote configuration from the Didomi Console. Defaults to true (not loading remote config).
Set this parameter to false to use a remote consent notice configuration loaded from the Didomi Console.
Set this parameter to true to disable loading configurations from the Didomi Console.
languageCode
string
Yes
Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings. This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: "es", "fr", etc.
Returns
Nothing
Example
C#
1
Didomi.GetInstance().Initialize(
2
apiKey: "<Your API key>",
3
localConfigurationPath: null,
4
remoteConfigurationURL: null,
5
providerId: null,
6
disableDidomiRemoteConfig: false,
7
languageCode: null);
Copied!

IsConsentRequired

Determine if consent is required for the user. This takes into account the location of the user and the configuration of the SDK:
  • If your app is configured to apply GDPR to all users then this function always returns true.
  • If your app is configured to apply GDPR to EU users only then this function returns true only if the user in the EU.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
bool
Example
C#
1
Didomi.GetInstance().IsConsentRequired();
Copied!

IsUserConsentStatusPartial

Determine if all consent information is available for the user.
This function returns true if and only if:
  • Consent is required for the user (ie the user is in the EU or your tag is configured to apply GDPR to all users)
  • At least one vendor is configured (if there is no vendor configured, this function always returns false as there is no consent to collect)
  • We miss consent information for some vendors or purposes
If there is at least one piece of consent information missing for a single vendor/purpose, this function will return true. The consent notice is usually displayed when this function returns true although there is no guarantee of the direct mapping between the two.
An important edge case is when you add new vendors or if configured vendors ask for new purposes: the consent notice will be displayed again and this function will return true until the user has given or denied consent. Vendors that already had consent before will still operate normally as we only recollect consent for additional vendors/purposes.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
bool
Example
C#
1
Didomi.GetInstance().IsUserConsentStatusPartial();
Copied!

IsNoticeVisible

Check if the consent notice is currently displayed.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
bool
Example
C#
1
Didomi.GetInstance().IsNoticeVisible();
Copied!

IsPreferencesVisible

Check if the preferences popup is currently displayed.
Requires SDK to be initialized
Yes.
Parameters
No parameter.
Returns
bool
Example
C#
1
Didomi.GetInstance().IsPreferencesVisible();
Copied!

IsReady

Check if the SDK is ready.
Requires SDK to be initialized
No.
Parameters
No parameter.
Returns
bool
Example
C#
1
Didomi.GetInstance().IsReady();
Copied!

OnReady

Add an event listener that will be called when the SDK is ready (ie fully initialized). If the event listener is added after the SDK initialization, the listener will be called immediately.
All calls to other functions of this API must only be made in a listener to the ready event to make sure that the SDK is initialized before it is used.
Requires SDK to be initialized
No.
Parameters
Name
Type
Description
callback
Action
An action to call when the SDK is ready
Returns
Nothing
Exampl
C#
1
Didomi.GetInstance().OnReady( () => {
2
// The SDK is ready
3
});
Copied!

SetupUI

Internally, the setupUI method calls the showNotice method, which calls the shouldConsentBeCollected method. Therefore, by calling the setupUI method, the notice or preferences view will be displayed only if required.
Setup the SDK UI workflows. By calling this method the notice or the preferences views will be displayed only once the SDK is ready and if consent should be collected.
For IOS platformsUIViewController returned by UnityGetGLViewController at Unity is used as base UI. For Android platforms Activity returned by com.unity3d.player.UnityPlayer.currentActivity is used as base UI.
Requires SDK to be initialized
No.
Parameters
No parameter.
Returns
Nothing
Example
C#
1
Didomi.GetInstance().SetupUI();
Copied!

ShowNotice

In most cases this method should be called if the notice should be displayed in response to a user action (e.g.: select the privacy settings section within your app). By calling the setupUI method, the notice will be displayed if required.
Show the consent notice. The consent notice actually only gets shown if needed (consent is required and we are missing consent information for some vendor or purpose).