In this article, we will cover multiple ways your organization can request a mapping of vendors and their configured purposes for a particular property using GDPR TCF.
getVendorPurposeMapping
command
The getVendorPurposeMapping
command returns an array that contains information of each vendor, the purposes that are applicable to that vendor, and the legal basis used for the applicable purposes.
Your organization can call the command through the browser console or an on-page script.
__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });
...
function show_vpm(vpm) {
for(i in vpm) {
var vendor = vpm[i];
var vendor_id = vendor.vendorId;
console.log(" ");
console.log("for vendor - " + vendor_id);
var all_categories = vendor.categories;
for(j in all_categories) {
var category = all_categories[j];
var purpose_id = category._id;
var leg_basis = category.type;
console.log(">> the purpose id is - " + purpose_id);
console.log(">> the legal basis is - " + leg_basis);
}
}
}
__tcfapi('getVendorPurposeMapping', 2, function(vpm, success) {
show_vpm(vpm)
});
...
API endpoint
API requests from a tool like Postman or a server-side script to retrieve the vendor and purpose mapping for a specific property can be made to:
GET https://cdn.privacy-mgmt.com/consent/tcfv2/vendor-list/vendor-purpose-mapping
Query string parameters
Parameter | Required | Description |
siteId |
true |
The site ID value is the same as the Property ID on the property for which you are making the request. It can be found on the Properties page inline with the property name. |
GET https://cdn.privacy-mgmt.com/consent/tcfv2/vendor-list/vendor-purpose-mapping?siteId=123456
If your organization is a using a server-side script using code similar to the following PHP example to retrieve the vendor purpose mapping, you will need to provide the correct values for the site_id with the API endpoint.
$site_id = "XXXXX";
$api_endpoint = "https://cdn.privacy-mgmt.com/consent/tcfv2/vendor-list/vendor-purpose-mapping?siteId=".$site_id;
$handle = curl_init($api_endpoint);
$fileHandle = fopen("vendor_purpose_mapping.json", "w");
/* If you encounter an 'SSL certificate problem: unable to get local issuer certificate' then enable the following two lines */
/* This is NOT recommended as a solution and should only be used as a quick and temporary fix */
//curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
//curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($handle, CURLOPT_FILE, $fileHandle);
curl_exec($handle);
curl_close($handle);
fclose($fileHandle);
Response
The response is a mapping of vendors and their configured purposes on the vendor list associated with the property.
Note: For each vendor, the response will only include purposes that have a configured legal basis (Consent, Legitimate Interest, Disclosure Only). Any purposes that are Not Applicable will not be returned in the response.
Additionally, vendors will need at least one purpose with a configured legal basis to be returned in the response.
The model for each array element in the response is as follows:
Attribute | Type | Description |
vendorId |
String | The unique ID for a vendor on the vendor list associated with the property |
categories |
Array | An array of objects that detail the purposes configured for each vendor on the vendor list associated with the property. |
categories
Each categories array element is an object that lists the purpose ids and their corresponding consent type for a particular vendor. The model for each object is as follows:
Key | Type | Value |
id |
String | The unique ID for a vendor on the vendor list associated with the property |
type |
String | The legal basis configured for the purpose. |
[
{
"vendorId": "5f1b2fbeb8e05c306f2a1ed6",
"categories": [
{
"_id": "5fd7e01e32bd4d27654ba1d5",
"type": "CONSENT"
},
{
"_id": "5fd7e01e32bd4d27654ba1db",
"type": "LEGITIMATE_INTEREST"
},
{
"_id": "5fd7e01e32bd4d27654ba1e7",
"type": "CONSENT"
},
{
"_id": "5fd8ee5b08b21c8a0d4bcbc2",
"type": "DISCLOSURE_ONLY"
}
]
},
{
"vendorId": "5f23e826b8e05c0c0d4fdb8f",
"categories": [
{
"_id": "5fd7e01e32bd4d27654ba1d5",
"type": "CONSENT"
},
{
"_id": "5fd7e01e32bd4d27654ba1f3",
"type": "CONSENT"
},
{
"_id": "5fd7e01e32bd4d27654ba1ff",
"type": "CONSENT"
},
{
"_id": "5fd7e01e32bd4d27654ba20b",
"type": "CONSENT"
}
]
},
{
"vendorId": "5f432c5838862e3e0d530c81",
"categories": [
{
"_id": "5fd7e01e32bd4d27654ba1d5",
"type": "LEGITIMATE_INTEREST"
},
{
"_id": "5fd7e01e32bd4d27654ba1db",
"type": "LEGITIMATE_INTEREST"
},
{
"_id": "5fd7e01e32bd4d27654ba1e7",
"type": "LEGITIMATE_INTEREST"
}
]
}
]