__tcfapi function - getVendorPurposeMapping call

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.


the getVendorPurposeMapping command

The command returns a data object that contains information on the purposes and corresponding legal basis attributed to each vendor. The getVendorPurposeMapping command can be called through the browser console window directly, via Javascript or through a server-side script like PHP:

Browser console control command

__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });

Sourcepoint API endpoint

https://sourcepoint.mgr.consensu.org/tcfv2/vendor-list/vendor-purpose-mapping?siteId={__SITE_ID__}

When using getVendorPurposeMapping command server-side please remember to provide the correct value of the site id with the API endpoint. This will further explained in the next section.


Example implementation

Your organization can use these examples to call the getVendorPurposeMapping command through the browser console or Javascript code on a webpage or server side script.

Browser console command Code example Server-side script (PHP example)
__tcfapi('getVendorPurposeMapping', 2, (vendorPurposeMapping, success) => { console.log(vendorPurposeMapping); });

API response

The response is a data object that maps the purposes and legal basis to a vendor. The categories section lists the purpose ids for each vendor with their legal basis type.

Parameter Description
_id Purpose ID
type The legal basis set for this purpose - consent, legitimate interest, not allowed, disclosure only
vendorId Vendor ID
0:
   categories:
      0: {_id: "60925aa29ccb1d3420efabf7", type: "CONSENT"}
      1: {_id: "60925aa29ccb1d3420efabfe", type: "CONSENT"}
      2: {_id: "60925aa29ccb1d3420efac05", type: "CONSENT"}
      3: {_id: "60925aa29ccb1d3420efac0b", type: "CONSENT"}    
      4: {_id: "60925aa29ccb1d3420efac12", type: "LEGITIMATE_INTEREST"}
      5: {_id: "60925aa29ccb1d3420efac19", type: "CONSENT"}
      6: {_id: "60925aa29ccb1d3420efac20", type: "CONSENT"}
      7: {_id: "60925aa29ccb1d3420efac27", type: "CONSENT"}
      8: {_id: "60925aa29ccb1d3420efac2e", type: "CONSENT"}
      9: {_id: "60925aa29ccb1d3420efac36", type: "CONSENT"}
10: {_id: "62092ef7dbaa6007ad004677", type: "DISCLOSURE_ONLY"} vendorId: "5e7ced57b8e05c47e418b73c" 1: categories: 0: {_id: "6011ea75c5d9c787531b3ecf", type: "CONSENT"} 1: {_id: "6011ea75c5d9c787531b3ed6", type: "CONSENT"} 2: {_id: "6011ea75c5d9c787531b3efd", type: "CONSENT"} 3: {_id: "6011ea75c5d9c787531b3f05", type: "CONSENT"}
4: {_id: "60925aa29ccb1d3420efac12", type: "CONSENT"} 5: {_id: "60925aa29ccb1d3420efac19", type: "CONSENT"} 6: {_id: "60925aa29ccb1d3420efac20", type: "CONSENT"} 7: {_id: "60925aa29ccb1d3420efac27", type: "CONSENT"} 8: {_id: "60925aa29ccb1d3420efac2e", type: "CONSENT"} 9: {_id: "60925aa29ccb1d3420efac36", type: "DISCLOSURE_ONLY"} vendorId: "5f1aada6b8e05c306c0597d7"
2: categories: 0: {_id: "60925aa29ccb1d3420efabf7", type: "CONSENT"} 1: {_id: "60925aa29ccb1d3420efabfe", type: "CONSENT"} 2: {_id: "60925aa29ccb1d3420efac05", type: "LEGITIMATE_INTEREST"} 3: {_id: "60925aa29ccb1d3420efac0b", type: "LEGITIMATE_INTEREST"}
4: {_id: "60925aa29ccb1d3420efac12", type: "LEGITIMATE_INTEREST"} 5: {_id: "60925aa29ccb1d3420efac19", type: "CONSENT"} 6: {_id: "60925aa29ccb1d3420efac20", type: "CONSENT"} 7: {_id: "60925aa29ccb1d3420efac27", type: "CONSENT"} 8: {_id: "60925aa29ccb1d3420efac2e", type: "LEGITIMATE_INTEREST"} 9: {_id: "60925aa29ccb1d3420efac36", type: "CONSENT"}
10: {_id: "62092ef7dbaa6007ad004677", type: "DISCLOSURE_ONLY"} vendorId: "5f3bc0d7b8e05c606f3dfc27"
3: categories: 0: {_id: "60925aa29ccb1d3420efac2e", type: "CONSENT"} 1: {_id: "60925aa29ccb1d3420efac36", type: "CONSENT"}
2: {_id: "62092ef7dbaa6007ad004677", type: "DISCLOSURE_ONLY"} vendorId: "5e37fc3e56a5e6614776722e"
Was this article helpful?
0 out of 0 found this helpful