__tcfapi function - getVendorPurposeMapping

Sourcepoint has extended the functionality of the IAB's TCF API to offer your organization additional commands that can be used with the __tcfapi() function call. This additional functionality provides a level of consistency and feature overlap between IAB TCF API and custom function integrations.

The getVendorPurposeMapping enables your organization to retrieve a list of vendors and map their purposes and legal bases for a specific property.

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, from an on-page script, or through a server-side script.

Browser console JavaScript Server-side (PHP)
Enter the following command directly into the browser tools' console window.
__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });


The response is an array where each array element details the consent type used by a vendor on your vendor list. 

Model Example

The model for each array element in the response is as follows:

Parameter Type Value
vendorId String The vendor ID of the vendor
categories Array A key:value list of the purpose:legal basis type

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:

Property Type Value
_id String The purpose ID 
type String The legal basis set for this purpose - consent, legitimate interest, not allowed, disclosure only
Was this article helpful?
0 out of 0 found this helpful