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.

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
import ConsentViewController

// Sourcepoint stub file (CMP setup for iOS)
class ViewController: UIViewController {
    @IBAction func onClearConsentTap(_ sender: Any) {
        SPConsentManager.clearAllData()
    }

    @IBAction func onGDPRPrivacyManagerTap(_ sender: Any) {
        consentManager.loadGDPRPrivacyManager(withId: "13111", tab: .Features)
    }

    @IBAction func onCCPAPrivacyManagerTap(_ sender: Any) {
        consentManager.loadCCPAPrivacyManager(withId: "14967")
    }

    lazy var consentManager: SPConsentManager = { SPConsentManager(
        accountId: 22,
        propertyName: try! SPPropertyName("mobile.multicampaign.demo"),
        campaignsEnv: .Public // optional - Public by default
        campaigns: SPCampaigns(
            gdpr: SPCampaign(), // optional
            ccpa: SPCampaign(), // optional
            ios14: SPCampaign() // optional
        ),
        delegate: self
    )}()

    override func viewDidLoad() {
        super.viewDidLoad()
        consentManager.loadMessage()
    }
}

// SPDelegate implementation
extension ViewController: SPDelegate {

        // onConsentReady function
        func onConsentReady(userData: SPUserData) {
                print("onConsentReady:", userData)
        }
        
        func onError(error: SPError) {
                print("Something went wrong: ", error)
        }

}
  
Android
// Sourcepoint stub file (CMP setup for Android)
public class MainActivityJava extends AppCompatActivity {
    
    private final SpConfig cmpConfig = new SpConfigDataBuilder()
            .addAccountId(22)
            .addPropertyName("mobile.multicampaign.demo")
            .addMessageLanguage(MessageLanguage.ENGLISH)
            .addCampaign(CampaignType.GDPR, Arrays.asList(new TargetingParam("location", "EU")))
            .addCampaign(CampaignType.CCPA, Arrays.asList(new TargetingParam("location", "US")))
            .build();

    private SpConsentLib spConsentLib = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        spConsentLib = FactoryKt.makeConsentLib(
                cmpConfig,
                this,
                new LocalClient()
        );
    }

    @Override
    protected void onResume() {
        super.onResume();
        spConsentLib.loadMessage();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        spConsentLib.dispose();
    }

    // SpClient implementation
    class LocalClient implements SpClient {
                                            
        // onConsentReady function
        @Override
        public void onConsentReady(@NotNull SPConsents c) {
            System.out.println("onConsentReady: " + c);
        }
        
        @Override
        public void onError(@NotNull Throwable error) {
            error.printStackTrace();
        }

    }
}
    

Within the 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.

  Note: 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.

applies Status is true if GDPR or CCPA applies to the end-user.
euconsent The TCstring generated from the end-user's choice.
onConsentReady: 
 gdpr: (	
  applies: true, 
  consents: (
  UserConsents	(
  	vendorGrants: [	
  		"5e7ced57b8e05c47e418b73c": VendorGrant	(	
  			granted: true, 
  			purposeGrants: [		
  				"60925aa29ccb1d3420efac12": true, 
  				"60925aa29ccb1d3420efac19": true, 
  				"60925aa29ccb1d3420efabfe": true, 
  				"60925aa29ccb1d3420efac36": true, 
  				"60925aa29ccb1d3420efabf7": true, 
  				"60925aa29ccb1d3420efac2e": true, 
  				"60925aa29ccb1d3420efac0b": true, 
  				"60925aa29ccb1d3420efac20": true, 
  				"60925aa29ccb1d3420efac27": true, 
  				"60925aa29ccb1d3420efac05": true
  			]	
  		), 
  		"5e37fc3e56a5e6614776722e": VendorGrant	(
  			granted: true, 
  			purposeGrants: [
  				"60925aa29ccb1d3420efac2e": true, 
  				"60925aa29ccb1d3420efac36": true
  			]	
  		), 
  		"5f1aada6b8e05c306c0597d7": VendorGrant	(
  			granted: true, 
  			purposeGrants: [
  				"60925aa29ccb1d3420efac0b": true, 
  				"60925aa29ccb1d3420efac19": true, 
  				"60925aa29ccb1d3420efac36": true, 
  				"60925aa29ccb1d3420efabf7": true, 
  				"60925aa29ccb1d3420efabfe": true, 
  				"60925aa29ccb1d3420efac12": true, 
  				"60925aa29ccb1d3420efac2e": true, 
  				"60925aa29ccb1d3420efac20": true, 
  				"60925aa29ccb1d3420efac27": true	
  			]	
  		)
  	],
  	euconsent: CPKadSDPKadSDAGABCENBlCsAP_AAABAAAYgF5wAwA2gHTAXmANsAEANoAwyACAvMVABAXmSgBABtAXmUgAgLzCQAQF5joAIC8wA.YAAAAAAAAAAA
  )
  )
  ), 
  ccpa: nil
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.