Load notice by ID
By default, the Didomi SDK downloads the notice configuration from the Console by matching the package ID of the app with the IDs configured in the notice.
This works well for most use cases but does not allow granularly deciding what notice configuration should be loaded in an app. For instance, it does not allow loading different consent notices in different versions of a single app.
You can bypass app ID targeting and decide what consent notice to use in a given app by specifying the notice ID in the call to the
initialize
function:Java
Kotlin
Swift
Objective-C
Didomi.getInstance().initialize(
this,
"<Public API key>",
null,
null,
null,
false,
null,
"<Notice ID>"
);
Didomi.getInstance().initialize(
this,
"<Public API key>",
null,
null,
null,
false,
null,
"<Notice ID>"
)
Didomi.shared.initialize(apiKey: "<Public API Key>",
localConfigurationPath: nil,
remoteConfigurationURL: nil,
providerId: nil,
disableDidomiRemoteConfig: false,
languageCode: nil,
noticeId: "<Notice ID>)
Didomi *didomi = [Didomi shared];
[didomi initializeWithApiKey:@"<Public API Key>" localConfigurationPath:nil remoteConfigurationURL:nil providerId:nil disableDidomiRemoteConfig:NO languageCode:nil noticeId:@"<Notice ID>"];
Make sure to replace the following variables in the code above:
<API Key>
: Use the public API key available in your Didomi Console<Notice ID>
: Use the notice ID available in your Didomi Console by looking at the URL when you are editing a consent notice (for instance, if your URL is https://console.didomi.io/didomi/widgets/notices/TQnRn8sr/embed, the notice ID isTQnRn8sr
)
Last modified 2yr ago