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. 

   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}

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. 

__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.

Did this answer your question?