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 provides a level of consistency and feature overlap between IAB TCF and custom function integrations.
Certain use cases may require your organization to change an end-user's consent profile outside the Sourcepoint first layer and privacy manager messages.
Use Case: Apply vendor-specific consent experiences to handle social media plugins. Or apply consent because an end-user accepts the website's T&Cs or a contract provided by a publisher or advertiser.
The postCustomConsent command can be used to edit a user's consent profile by changing the opt-in status for consented vendors, categories (purposes) and legitimate interest categories (purposes).
postCustomConsent
command
The command returns a JSON object that contains information on the purposes attributed to each vendor and their legal basis. Here is the format of the postCustomConsent
command:
Parameter description
Parameter | Description |
vendor ids | List of vendor IDs your organization wish to update. Comma delimited. |
purpose ids | List of purpose IDs your organization wish to update to 'consent only'. Comma delimited. |
legitimate interest purpose ids | List of purpose IDs your organization wish to update to 'legitimate interest'. Comma delimited. |
__tcfapi('postCustomConsent',2,callback function,[vendors ids],[purpose ids],[legitimate interest purposes ids])
Note: You will need to consent to both vendors and purposes. Consenting to a vendor only does not include the purposes.
Code example
function callback_fn(data, success) {
// your custom callback code can be included here
console.log(data, success)
}
// call the postCustomConsent command to update consented vendors
__tcfapi('postCustomConsent', 2, callback_fn, ["5f3bc0d7b8e05c606f3dfc27", "5f477cc6c442796aa67839d9", "5fd78083fc186126cb9fabad", "5f3a3e66ee0a81887437291c", "5fda5252b4f7ae27b97a1dfe", "5e7ced57b8e05c47e418b73c"], [], [] );
// call the postCustomConsent command to update consented purposes
__tcfapi('postCustomConsent', 2, callback_fn, [], ["6011ea75c5d9c787531b3ecf", "6011ea75c5d9c787531b3f0e"], [] );
// call the postCustomConsent command to update legitimate interest purposes
__tcfapi('postCustomConsent', 2, callback_fn, [], [], ["6011ea75c5d9c787531b3ecf", "6011ea75c5d9c787531b3f0e"] );
postCustomConsent
response
The response is a JSON object that contains the updated consent data and this is divided into six parts - categories
, customVendorResponse
, grants
, legIntCategories
, legIntVendors
and vendors
. The format of these six sections will be described next.
Categories
The categories section lists the purpose ids mapped to consented vendors. The output format is as follows:
categories: ["purpose id 1", "purpose id 2", ...]
categories: Array(10)
0: "6011ea75c5d9c787531b3ecf"
1: "6011ea75c5d9c787531b3ed6"
2: "6011ea75c5d9c787531b3ede"
3: "6011ea75c5d9c787531b3ee6"
4: "6011ea75c5d9c787531b3eed"
5: "6011ea75c5d9c787531b3ef5"
6: "6011ea75c5d9c787531b3efd"
7: "6011ea75c5d9c787531b3f05"
8: "6011ea75c5d9c787531b3f0e"
9: "6011ea75c5d9c787531b3f18"