Sourcepoint support the getVendorConsents and getConsentData functionality of the IAB __cmp() function. Below is information on how to utilize these features.

Using getConsentData

To retrieve the users consent string, the function below can be called. A JSON object with the user's consent string will be returned.

__cmp('getConsentData', null, callback function);


The function below will print the user's consent string to the console and is useful troubleshooting tool.

__cmp('getConsentData', null, function(result) {console.log(result);});


The definition of the fields returned in the JSON object are below:

  • consentData - the consent string for the user as defined by the IAB.
  • gdprApplies - whether or not gdprApplies for this specific user. This is based on the users current geographic location.
  • hasGlobalScope - whether or not the publisher participated in the global scope of the IAB's consent framework.

Using getVendorConsents 

To retrieve the purposes and vendor IDs that the user has consented to, the function below can be called. The vendor and consent IDs will be returned as a JSON object to the callback function provided.

__cmp('getVendorConsents', null, callback function);

The data sent to the callback function will be formatted similarly to the JSON object below. Each ID corresponds to a specific IAB purpose and global vendor list vendor. 

{
   metadata: "BOdQWB-OdTcFmAGABBAACJAAAAAAAA",
   gdprApplies: true,
   hasGlobalScope: true,
   purposeConsents:{1: true, 2: true, 3: true, 4: true, 5: true},
   vendorConsents: {1: true, 2: true, 3: true, 4: true, 6: true, 7: true}
}

Using getVendorConsents for Specific Vendors

If you want to check the consent for a specific vendor or list of several vendors you can pass an array of vendor IDs to the function like in the example below where we are making a call to getVendorConsents to retrieve the consent data for vendor ID 1, 2, & 3. This will limit the data returned to the vendors listed.

__cmp('getVendorConsents', [1,2,3], callback function);

The JSON Object returned is defined below

  • metadata - The metadata will be the base64url-encoded value of the "header" information.
  • gdprApplies - true or false value as to whether gdpr regulations are applicable to this user.
  • hasGlobalScope - true if the publisher is participating in the IAB Global Consent Framework.
  • purposeConsents - a list of purpose IDs to which the user has consented.
  • vendorConsents - a list of vendor IDs to which the user has consented.

Using getCustomVendorConsents for Custom (Non-IAB vendors)

If you want to check on the consent status of custom vendors who are not part of the IAB using our JavaScript API, Sourcepoint has created a custom function to accomplish this.  The function will always return all purposes including custom purposes and all custom vendors in the callback function defined to which the user has consented.

Below is an example use of the function that writes the custom consent JSON object to the console window.

__cmp('getCustomVendorConsents', null, function(vendorConsents) {
console.log(vendorConsents);
});

The JSON Data returned is defined below

  • consentedPurposes - a list of purpose IDs to which the user has consented with their names and IDs.
  • consentedVendors - a list of vendor IDs to which the user has consented with their names and IDs.

Did this answer your question?