Third-party SDKs
IAB Vendor
The Didomi SDK shares the user consent status with vendors through the IAB GDPR Consent framework.
For vendors that support the framework (see the list here), the only thing you have to do is declare them in the list of vendors that your app uses (see the Getting Started section for more information on how to do that) and they will adapt their data processing to respect the user consent.
Non-IAB Vendor
For other vendors, that do not implement the IAB specification, you will need to share the consent status with their SDK if they have an API to do so or prevent their SDK from loading until the user has given consent for the vendor and its purposes. This has to be done manually for every vendor.
Vendor with custom API
Some vendors will offer a custom (non-IAB) API to tell their SDK what the user consent status is. In that case, check the user consent status for the vendor and pass it to the SDK:
public void loadVendor() {
boolean vendorHasConsent = Didomi.getInstance().getUserStatus()
.getVendors().getGlobalConsent().getEnabled().contains("vendor-id");
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
} else {
// We do not have consent information yet
// Wait until we get the user information
Didomi.getInstance().addEventListener(new EventListener() {
@Override
public void consentChanged(@NotNull ConsentChangedEvent event) {
loadVendor();
Didomi.getInstance().removeEventListener(this);
}
});
}
}
Didomi.getInstance().onReady(() -> {
loadVendor();
});
fun loadVendor() {
val didomi = Didomi.getInstance()
val vendorHasConsent = didomi.userStatus
.vendors.globalConsent.enabled.contains("vendor-id")
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
} else {
// We do not have consent information yet
// Wait until we get the user information
didomi.addEventListener(object : EventListener() {
override fun consentChanged(event: ConsentChangedEvent) {
loadVendor()
didomi.removeEventListener(this)
}
})
}
}
Didomi.getInstance().onReady { loadVendor() }
func loadVendor() {
let didomi: Didomi = Didomi.shared
let vendorHasConsent = didomi.getUserStatus().vendors.globalConsent.enabled.contains("vendor-id")
if vendorHasConsent {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
} else {
let didomiEventListener = EventListener()
didomiEventListener.onConsentChanged = { [unowned self] event in
self.loadVendor()
didomi.removeEventListener(listener: didomiEventListener)
}
didomi.addEventListener(listener: didomiEventListener)
}
}
Didomi.shared.onReady {
self.loadVendor()
}
- (void)viewDidLoad {
[super viewDidLoad];
Didomi *didomi = [Didomi shared];
[didomi onReadyWithCallback:^{
[self loadVendor];
}];
}
- (void)loadVendor {
Didomi *didomi = [Didomi shared];
NSSet<NSString *>* enabledVendorsConsent = [[[[didomi getUserStatus] vendors] globalConsent] enabled];
if ([enabledVendorsConsent containsObject:@"vendor-id"]) {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
} else {
DDMEventListener *didomiEventListener = [[DDMEventListener alloc] init];
__weak DDMEventListener *wDidomiEventListener = didomiEventListener;
[didomiEventListener setOnConsentChanged:^(enum DDMEventType event) {
[self loadVendor];
[didomi removeEventListenerWithListener: wDidomiEventListener];
}];
[didomi addEventListenerWithListener:didomiEventListener];
}
}
public void LoadVendor()
{
ISet<String> enabledVendors = Didomi.GetInstance().GetUserStatus().GetVendors().GetGlobalConsent().GetEnabled();
bool vendorHasConsent = enabledVendors.Contains("vendor-id");
if (vendorHasConsent)
{
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
}
else
{
// We do not have consent information yet
// Wait until we get the user information
DidomiEventListener eventListener = new DidomiEventListener();
eventListener.ConsentChanged += EventListener_ConsentChanged;
Didomi.GetInstance().AddEventListener(eventListener);
}
}
private void EventListener_ConsentChanged(object sender, ConsentChangedEvent e)
{
LoadVendor();
}
Didomi.GetInstance().OnReady( () => LoadVendor() );
async function loadVendor() {
let vendorHasConsent = (await Didomi.getUserStatus()).vendors.global_consent.enabled.includes("vendor-id");
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
} else {
let consentListener = (data: any) => {
loadVendor();
Didomi.removeEventListener(DidomiEventType.CONSENT_CHANGED, consentListener);
};
Didomi.addEventListener(DidomiEventType.CONSENT_CHANGED, consentListener);
}
}
Didomi.onReady().then(() => {
loadVendor();
});
void requestLoadVendor() {
final consentListener = EventListener();
consentListener.onConsentChanged = () {
loadVendorIfConsent(consentListener);
consentListener.onConsentChanged = () {};
};
DidomiSdk.addEventListener(consentListener);
loadVendorIfConsent(consentListener);
}
void loadVendorIfConsent(EventListener consentListener) async {
final hasVendorStatus = (await DidomiSdk.userStatus).vendors?.globalConsent?.enabled?.contains("vendor-id") == true;
if (hasVendorStatus) {
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
consentListener.onConsentChanged = () {};
}
}
DidomiSdk.onReady(() => { requestLoadVendor() });
Vendor without a custom API
For vendors that do not offer a custom API to share the user consent status, your only option is to not load their SDK until the user has given consent. Use the following snippet of code to get started:
public void loadVendor() {
boolean vendorHasConsent = Didomi.getInstance().getUserStatus()
.getVendors().getGlobalConsent().getEnabled().contains("vendor-id");
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK
} else {
// We do not have consent information yet
// Wait until we get the user information
Didomi.getInstance().addEventListener(new EventListener() {
@Override
public void consentChanged(@NotNull ConsentChangedEvent event) {
loadVendor();
Didomi.getInstance().removeEventListener(this);
}
});
}
}
Didomi.getInstance().onReady(() -> {
loadVendor();
});
fun loadVendor() {
val didomi = Didomi.getInstance()
val vendorHasConsent = didomi.userStatus
.vendors.globalConsent.enabled.contains("vendor-id")
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK
} else {
// We do not have consent information yet
// Wait until we get the user information
didomi.addEventListener(object : EventListener() {
override fun consentChanged(event: ConsentChangedEvent) {
loadVendor()
didomi.removeEventListener(this)
}
})
}
}
Didomi.getInstance().onReady { loadVendor() }
func loadVendor() {
let didomi: Didomi = Didomi.shared
let vendorHasConsent = didomi.getUserStatus().vendors.globalConsent.enabled.contains("vendor-id")
if vendorHasConsent {
// We have consent for the vendor
// Initialize the vendor SDK
} else {
let didomiEventListener = EventListener()
didomiEventListener.onConsentChanged = { [unowned self] event in
self.loadVendor()
didomi.removeEventListener(listener: didomiEventListener)
}
didomi.addEventListener(listener: didomiEventListener)
}
}
Didomi.shared.onReady {
self.loadVendor()
}
- (void)viewDidLoad {
[super viewDidLoad];
Didomi *didomi = [Didomi shared];
[didomi onReadyWithCallback:^{
[self loadVendor];
}];
}
- (void)loadVendor {
Didomi *didomi = [Didomi shared];
NSSet<NSString *>* enabledVendorsConsent = [[[[didomi getUserStatus] vendors] globalConsent] enabled];
if ([enabledVendorsConsent containsObject:@"vendor-id"]) {
// We have consent for the vendor
// Initialize the vendor SDK
} else {
DDMEventListener *didomiEventListener = [[DDMEventListener alloc] init];
__weak DDMEventListener *wDidomiEventListener = didomiEventListener;
[didomiEventListener setOnConsentChanged:^(enum DDMEventType event) {
[self loadVendor];
[didomi removeEventListenerWithListener: wDidomiEventListener];
}];
[didomi addEventListenerWithListener:didomiEventListener];
}
}
public void LoadVendor()
{
ISet<String> enabledVendors = Didomi.GetInstance().GetUserStatus().GetVendors().GetGlobalConsent().GetEnabled();
bool vendorHasConsent = enabledVendors.Contains("vendor-id");
if (vendorHasConsent)
{
// We have consent for the vendor
// Initialize the vendor SDK and pass the positive consent status
}
else
{
// We do not have consent information yet
// Wait until we get the user information
DidomiEventListener eventListener = new DidomiEventListener();
eventListener.ConsentChanged += EventListener_ConsentChanged;
Didomi.GetInstance().AddEventListener(eventListener);
}
}
private void EventListener_ConsentChanged(object sender, ConsentChangedEvent e)
{
LoadVendor();
}
Didomi.GetInstance().OnReady( () => LoadVendor() );
async function loadVendor() {
let vendorHasConsent = (await Didomi.getUserStatus()).vendors.global_consent.enabled.includes("vendor-id");
if (vendorHasConsent) {
// We have consent for the vendor
// Initialize the vendor SDK
} else {
let consentListener = (data: any) => {
loadVendor();
Didomi.removeEventListener(DidomiEventType.CONSENT_CHANGED, consentListener);
};
Didomi.addEventListener(DidomiEventType.CONSENT_CHANGED, consentListener);
}
}
Didomi.onReady().then(() => {
loadVendor();
});
void requestLoadVendor() {
final consentListener = EventListener();
consentListener.onConsentChanged = () {
loadVendorIfConsent(consentListener);
consentListener.onConsentChanged = () {};
};
DidomiSdk.addEventListener(consentListener);
loadVendorIfConsent(consentListener);
}
void loadVendorIfConsent(EventListener consentListener) async {
final hasVendorStatus = (await DidomiSdk.userStatus).vendors?.globalConsent?.enabled?.contains("vendor-id") == true;
if (hasVendorStatus) {
// We have consent for the vendor
// Initialize the vendor SDK
consentListener.onConsentChanged = () {};
}
}
DidomiSdk.onReady(() => { requestLoadVendor() });
Google Additional Consent Mode
The mobile SDK supports Google Additional Consent Mode, as described in Google's additional consent mode.
To handle it, the values for positive and negative additional consent string have to be set in the custom JSON:
{
"app": {
"vendors": {
"google": {
"additionalConsent": {
"positive": "positive-additional-consent",
"negative": ""
}
}
}
}
}
Last updated