Vendor grants (Mobile)
A vendor grant is a boolean value that is true if an end-user has consented to all purposes assigned to a vendor. The vendor grant value is false if one or more purposes have been disallowed by the end-user. Where the vendor grant has been set to false, your organization should check which purposes have been rejected by the end-user.
In this article, we will cover how to request vendor grants for mobile CMP implementations.
Click here for additional documentation on vendor grants as described by the IAB TCF API function.
The Sourcepoint Unified SDK for mobile devices provides the callback function onConsentReady that allows your organization to read vendor grants. This command can be called as shown in the following example:
Swift/iOS
Android
1
import ConsentViewController
2
3
// Sourcepoint stub file (CMP setup for iOS)
4
class ViewController: UIViewController {
5
@IBAction func onClearConsentTap(_ sender: Any) {
6
SPConsentManager.clearAllData()
7
}
8
9
@IBAction func onGDPRPrivacyManagerTap(_ sender: Any) {
10
consentManager.loadGDPRPrivacyManager(withId: "13111", tab: .Features)
11
}
12
13
@IBAction func onCCPAPrivacyManagerTap(_ sender: Any) {
14
consentManager.loadCCPAPrivacyManager(withId: "14967")
15
}
16
17
lazy var consentManager: SPConsentManager = { SPConsentManager(
18
accountId: 22,
19
propertyName: try! SPPropertyName("mobile.multicampaign.demo"),
20
campaignsEnv: .Public // optional - Public by default
21
campaigns: SPCampaigns(
22
gdpr: SPCampaign(), // optional
23
ccpa: SPCampaign(), // optional
24
ios14: SPCampaign() // optional
25
),
26
delegate: self
27
)}()
28
29
override func viewDidLoad() {
30
super.viewDidLoad()
31
consentManager.loadMessage()
32
}
33
}
34
35
// SPDelegate implementation
36
extension ViewController: SPDelegate {
37
38
// onConsentReady function
39
func onConsentReady(userData: SPUserData) {
40
print("onConsentReady:", userData)
41
}
42
43
func onError(error: SPError) {
44
print("Something went wrong: ", error)
45
}
46
47
}
Copied!
1
2
// Sourcepoint stub file (CMP setup for Android)
3
public class MainActivityJava extends AppCompatActivity {
4
5
private final SpConfig cmpConfig = new SpConfigDataBuilder()
6
.addAccountId(22)
7
.addPropertyName("mobile.multicampaign.demo")
8
.addMessageLanguage(MessageLanguage.ENGLISH)
9
.addCampaign(CampaignType.GDPR, Arrays.asList(new TargetingParam("location", "EU")))
10
.addCampaign(CampaignType.CCPA, Arrays.asList(new TargetingParam("location", "US")))
11
.build();
12
13
private SpConsentLib spConsentLib = null;
14
15
@Override
16
protected void onCreate(Bundle savedInstanceState) {
17
super.onCreate(savedInstanceState);
18
setContentView(R.layout.activity_main);
19
spConsentLib = FactoryKt.makeConsentLib(
20
cmpConfig,
21
this,
22
new LocalClient()
23
);
24
}
25
26
@Override
27
protected void onResume() {
28
super.onResume();
29
spConsentLib.loadMessage();
30
}
31
32
@Override
33
protected void onDestroy() {
34
super.onDestroy();
35
spConsentLib.dispose();
36
}
37
38
// SpClient implementation
39
class LocalClient implements SpClient {
40
41
// onConsentReady function
42
@Override
43
public void onConsentReady(@NotNull SPConsents c) {
44
System.out.println("onConsentReady: " + c);
45
}
46
47
@Override
48
public void onError(@NotNull Throwable error) {
49
error.printStackTrace();
50
}
51
52
}
53
}
Copied!
JSON response
The grants section in the response using the Unified SDK "onConsentReady" function lists the consented purposes for each vendor. The consented purposes are listed as follows:
Parameter
Description
vendorGrants[]
A list of vendors in the vendor list.
purposeGrants[]
A list of purposes associated with a vendor.
granted
Status is true if the end-user has consented to all purposes.
applies
Status is true if GDPR or CCPA applies to the end-user.
euconsent
The TC String generated from the end-user's choice.
The granted status is set to true if the end-user has granted consent to all purposes assigned to a vendor. If the end-user denies consent for one or more purposes then the granted status is set to false.
1
onConsentReady:
2
gdpr: Optional (
3
applies: true,
4
consents: Optional (
5
UserConsents (
6
vendorGrants: [
7
"5e7ced57b8e05c47e418b73c": VendorGrant (
8
granted: true,
9
purposeGrants: [
10
"60925aa29ccb1d3420efac12": true,
11
"60925aa29ccb1d3420efac19": true,
12
"60925aa29ccb1d3420efabfe": true,
13
"60925aa29ccb1d3420efac36": true,
14
"60925aa29ccb1d3420efabf7": true,
15
"60925aa29ccb1d3420efac2e": true,
16
"60925aa29ccb1d3420efac0b": true,
17
"60925aa29ccb1d3420efac20": true,
18
"60925aa29ccb1d3420efac27": true,
19
"60925aa29ccb1d3420efac05": true
20
]
21
),
22
"5e37fc3e56a5e6614776722e": VendorGrant (
23
granted: true,
24
purposeGrants: [
25
"60925aa29ccb1d3420efac2e": true,
26
"60925aa29ccb1d3420efac36": true
27
]
28
),
29
"5f1aada6b8e05c306c0597d7": VendorGrant (
30
granted: true,
31
purposeGrants: [
32
"60925aa29ccb1d3420efac0b": true,
33
"60925aa29ccb1d3420efac19": true,
34
"60925aa29ccb1d3420efac36": true,
35
"60925aa29ccb1d3420efabf7": true,
36
"60925aa29ccb1d3420efabfe": true,
37
"60925aa29ccb1d3420efac12": true,
38
"60925aa29ccb1d3420efac2e": true,
39
"60925aa29ccb1d3420efac20": true,
40
"60925aa29ccb1d3420efac27": true
41
]
42
)
43
],
44
euconsent: CPKadSDPKadSDAGABCENBlCsAP_AAABAAAYgF5wAwA2gHTAXmANsAEANoAwyACAvMVABAXmSgBABtAXmUgAgLzCQAQF5joAIC8wA.YAAAAAAAAAAA
45
)
46
)
47
),
48
ccpa: nil
Copied!
Last modified 2mo ago
Export as PDF
Copy link