Third-party SDKs
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.
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.
Read on to see how to manage the different cases of non-IAB vendors.

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:
Java
Swift
Objective-C
C# (Unity)
1
public void loadVendor() {
2
Boolean consentStatusForVendor = Didomi.getInstance().getUserConsentStatusForVendorAndRequiredPurposes("vendor-id");
3
4
if (consentStatusForVendor == true) {
5
// We have consent for the vendor
6
// Initialize the vendor SDK and pass the positive consent status
7
} else {
8
// We do not have consent information yet
9
// Wait until we get the user information
10
Didomi.getInstance().addEventListener(new EventListener() {
11
@Override
12
public void consentChanged(ConsentChangedEvent event) {
13
loadVendor();
14
}
15
});
16
}
17
}
18
19
Didomi.getInstance().onReady(() -> {
20
loadVendor();
21
});
Copied!
1
func loadVendor() {
2
let didomi = Didomi.shared
3
let consentStatus = didomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId: "vendor-id")
4
let didomiEventListener: EventListener
5
6
switch consentStatus {
7
case .enable:
8
// We have consent for the vendor
9
// Initialize the vendor SDK and pass the positive consent status
10
print("Enable")
11
case .disable:
12
// We do not have consent information yet
13
// Wait until we get the user information
14
didomiEventListener = EventListener()
15
didomiEventListener.onConsentChanged = { [unowned self] event in
16
self.loadVendor()
17
}
18
didomi.addEventListener(listener: didomiEventListener)
19
case .unknown:
20
// Consent information could not be found for the provided vendor ID.
21
// This could be due to the ID not belonging to any required vendor.
22
print("Unknown")
23
}
24
}
25
26
Didomi.shared.onReady {
27
self.loadVendor()
28
}
Copied!
1
- (void)viewDidLoad {
2
[super viewDidLoad];
3
4
Didomi *didomi = [Didomi shared];
5
[didomi onReadyWithCallback:^{
6
[self loadVendor];
7
}];
8
}
9
10
- (void)loadVendor {
11
Didomi *didomi = [Didomi shared];
12
ConsentStatus consentStatusForVendor = [didomi getUserConsentStatusForVendorAndRequiredPurposesWithVendorId:@"vendor-id"];
13
DDMEventListener *didomiEventListener;
14
15
switch (consentStatusForVendor) {
16
case ConsentStatusEnable:
17
// We have consent for the vendor
18
// Initialize the vendor SDK and pass the positive consent status
19
break;
20
case ConsentStatusDisable:
21
// We do not have consent information yet
22
// Wait until we get the user information
23
didomiEventListener = [[DDMEventListener alloc] init];
24
[didomiEventListener setOnConsentChanged:^(enum DDMEventType event) {
25
[self loadVendor];
26
}];
27
28
[didomi addEventListenerWithListener:didomiEventListener];
29
break;
30
}
31
}
Copied!
1
public void LoadVendor() {
2
bool consentStatusForVendor = Didomi.GetInstance().GetUserConsentStatusForVendorAndRequiredPurposes("vendor-id");
3
4
if (consentStatusForVendor) {
5
// We have consent for the vendor
6
// Initialize the vendor SDK and pass the positive consent status
7
} else {
8
// We do not have consent information yet
9
// Wait until we get the user information
10
EventListener eventListener = new EventListener();
11
eventListener.ConsentChanged += EventListener_ConsentChanged;
12
13
Didomi.GetInstance().AddEventListener(eventListener);
14
}
15
}
16
17
private void EventListener_ConsentChanged(object sender, ConsentChanged e)
18
{
19
LoadVendor();
20
}
21
22
Didomi.GetInstance().OnReady( () => LoadVendor() );
Copied!

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:
Java
Swift
Objective-C
C# (Unity)
1
public void loadVendor() {
2
Boolean consentStatusForVendor = Didomi.getInstance().getUserConsentStatusForVendorAndRequiredPurposes("vendor-id");
3
4
if (consentStatusForVendor == true) {
5
// We have consent for the vendor
6
// Initialize the vendor SDK
7
} else {
8
// We do not have consent information yet
9
// Wait until we get the user information
10
Didomi.getInstance().addEventListener(new EventListener() {
11
@Override
12
public void consentChanged(ConsentChangedEvent event) {
13
loadVendor();
14
}
15
});
16
}
17
}
18
19
Didomi.getInstance().onReady(() -> {
20
loadVendor();
21
});
Copied!
1
func loadVendor() {
2
let didomi = Didomi.shared
3
let consentStatus = didomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId: "vendor-id")
4
let didomiEventListener: EventListener
5
6
switch consentStatus {
7
case .enable:
8
// We have consent for the vendor
9
// Initialize the vendor SDK
10
print("Enable")
11
case .disable:
12
// We do not have consent information yet
13
// Wait until we get the user information
14
didomiEventListener = EventListener()
15
didomiEventListener.onConsentChanged = { [unowned self] event in
16
self.loadVendor()
17
}
18
didomi.addEventListener(listener: didomiEventListener)
19
}
20
}
21
22
Didomi.shared.onReady {
23
loadVendor()
24
}
Copied!
1
- (void)viewDidLoad {
2
[super viewDidLoad];
3
4
Didomi *didomi = [Didomi shared];
5
[didomi onReadyWithCallback:^{
6
[self loadVendor];
7
}];
8
}
9
10
- (void)loadVendor {
11
Didomi *didomi = [Didomi shared];
12
ConsentStatus consentStatusForVendor = [didomi getUserConsentStatusForVendorAndRequiredPurposesWithVendorId:@"vendor-id"];
13
DDMEventListener *didomiEventListener;
14
15
switch (consentStatusForVendor) {
16
case ConsentStatusEnable:
17
// We have consent for the vendor
18
// Initialize the vendor SDK
19
break;
20
case ConsentStatusDisable:
21
// We do not have consent information yet
22
// Wait until we get the user information
23
didomiEventListener = [[DDMEventListener alloc] init];
24
[didomiEventListener setOnConsentChanged:^(enum DDMEventType event) {
25
[self loadVendor];
26
}];
27
28
[didomi addEventListenerWithListener:didomiEventListener];
29
break;
30
}
31
}
Copied!
1
public void loadVendor() {
2
Boolean consentStatusForVendor = Didomi.getInstance().getUserConsentStatusForVendorAndRequiredPurposes("vendor-id");
3
4
if (consentStatusForVendor == true) {
5
// We have consent for the vendor
6
// Initialize the vendor SDK
7
} else {
8
// We do not have consent information yet
9
// Wait until we get the user information
10
EventListener eventListener = new EventListener();
11
eventListener.ConsentChanged += EventListener_ConsentChanged;
12
13
Didomi.GetInstance().AddEventListener(eventListener);
14
}
15
}
16
17
private void EventListener_ConsentChanged(object sender, ConsentChanged e)
18
{
19
LoadVendor();
20
}
21
22
23
Didomi.GetInstance().OnReady( () => LoadVendor() );
Copied!
Last modified 4mo ago