postCustomConsent command
Writing consent for Custom Vendors
Sourcepoint has extended the functionality of the IAB's TCFv2 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 TCFv2 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
vendors 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])
You will need to consent to both vendors and purposes. Consenting to a vendor only does not include the purposes.
Code example
1
function callback_fn(data, success) {
2
// your custom callback code can be included here
3
console.log(data, success)
4
}
5
6
// call the postCustomConsent command to update consented vendors
7
__tcfapi('postCustomConsent', 2, callback_fn, ["5f3bc0d7b8e05c606f3dfc27", "5f477cc6c442796aa67839d9", "5fd78083fc186126cb9fabad", "5f3a3e66ee0a81887437291c", "5fda5252b4f7ae27b97a1dfe", "5e7ced57b8e05c47e418b73c"], [], [] );
8
// call the postCustomConsent command to update consented purposes
9
__tcfapi('postCustomConsent', 2, callback_fn, [], ["6011ea75c5d9c787531b3ecf", "6011ea75c5d9c787531b3f0e"], [] );
10
// call the postCustomConsent command to update legitimate interest purposes
11
__tcfapi('postCustomConsent', 2, callback_fn, [], [], ["6011ea75c5d9c787531b3ecf", "6011ea75c5d9c787531b3f0e"] );
Copied!

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
customVendorResponse
grants
legIntCategories
legIntVendors
vendors
The categories section lists the purpose ids mapped to consented vendors. The output format is as follows:
categories: ["purpose id 1", "purpose id 2", ...]
1
categories: Array(10)
2
0: "6011ea75c5d9c787531b3ecf"
3
1: "6011ea75c5d9c787531b3ed6"
4
2: "6011ea75c5d9c787531b3ede"
5
3: "6011ea75c5d9c787531b3ee6"
6
4: "6011ea75c5d9c787531b3eed"
7
5: "6011ea75c5d9c787531b3ef5"
8
6: "6011ea75c5d9c787531b3efd"
9
7: "6011ea75c5d9c787531b3f05"
10
8: "6011ea75c5d9c787531b3f0e"
11
9: "6011ea75c5d9c787531b3f18"
Copied!
The customVendorsResponse section lists the purpose ids and purpose descriptions mapped to the vendors. For consentedPurposes & legIntPurposes the output format is as follows:
Parameter
Description
_id
Purpose ID
name
Purpose name as defined in each vendor list
1
customVendorsResponse:
2
consentedPurposes:
3
0: {_id: "6011ea75c5d9c787531b3ecf", name: "Select basic ads"}
4
1: {_id: "6011ea75c5d9c787531b3ed6", name: "Measure ad performance"}
5
2: {_id: "6011ea75c5d9c787531b3ede", name: "Apply market research to generate audience insights"}
6
3: {_id: "6011ea75c5d9c787531b3ee6", name: "Select personalised content"}
7
4: {_id: "6011ea75c5d9c787531b3eed", name: "Create a personalised content profile"}
8
5: {_id: "6011ea75c5d9c787531b3ef5", name: "Measure content performance"}
9
6: {_id: "6011ea75c5d9c787531b3efd", name: "Select personalised ads"}
10
7: {_id: "6011ea75c5d9c787531b3f05", name: "Create a personalised ads profile"}
11
8: {_id: "6011ea75c5d9c787531b3f0e", name: "Store and/or access information on a device"}
12
9: {_id: "6011ea75c5d9c787531b3f18", name: "Develop and improve products"}
13
legIntPurposes:
14
0: {_id: "6011ea75c5d9c787531b3ede", name: "Apply market research to generate audience insights"}
15
1: {_id: "6011ea75c5d9c787531b3ee6", name: "Select personalised content"}
16
2: {_id: "6011ea75c5d9c787531b3eed", name: "Create a personalised content profile"}
17
3: {_id: "6011ea75c5d9c787531b3ef5", name: "Measure content performance"}
18
4: {_id: "6011ea75c5d9c787531b3f05", name: "Create a personalised ads profile"}
19
5: {_id: "6011ea75c5d9c787531b3f18", name: "Develop and improve products"}
Copied!
For consentedVendors the output format is as follows:
Parameter
Description
_id
Internal purpose ID, vendor list specific
name
Purpose name as defined in each vendor list
vendorType
Does the vendor belong to the IAB or to another affiliation
1
customVendorsResponse:
2
consentedVendors:
3
0: {_id: "5e37fc3e56a5e6614776722e", name: "Haensel AMS GmbH", vendorType: "IAB"}
4
1: {_id: "5f520ca8b8e05c65914d2607", name: "TX Group AG", vendorType: "IAB"}
Copied!
The grants section lists the purpose ids mapped to vendors that apply to the end-user after the command has been executed. The grants are listed as follows:
Parameter
Description
vendor_id
Vendor ID
purpose_id
Purpose ID
status
Status is true if the purpose applies to the end-user.
vendorGrant
Status is true if all purposes for a vendor apply to the end-user. Status is false if one or more purposes for the vendor do not apply to the end-user.
vendor_id: purposeGrants: { "purpose_id 1": status, "purpose_id 2": status, ...}, vendorGrant: status
The vendorGrant status is set to true if the end-user has granted consent to all purposes assigned to a vendor. If the end-user denies consent for one or more purposes then the vendorGrant status is set to false.
1
grants:
2
5e37fc3e56a5e6614776722e:
3
purposeGrants: {
4
6011ea75c5d9c787531b3ecf: true,
5
6011ea75c5d9c787531b3ed6: true,
6
6011ea75c5d9c787531b3ede: true,
7
6011ea75c5d9c787531b3efd: true,
8
6011ea75c5d9c787531b3f0e: true,
9
6011ea75c5d9c787531b3f05: true,
10
6011ea75c5d9c787531b3f18: true
11
},
12
vendorGrant: true
Copied!
The legitimate interest categories section lists the legitimate interest purpose ids mapped to vendors. The output format is as follows:
legIntCategories: ["purpose id 1", "purpose id 2", ...]
1
legIntCategories: Array(6)
2
0: "6011ea75c5d9c787531b3ede"
3
1: "6011ea75c5d9c787531b3ee6"
4
2: "6011ea75c5d9c787531b3eed"
5
3: "6011ea75c5d9c787531b3ef5"
6
4: "6011ea75c5d9c787531b3f05"
7
5: "6011ea75c5d9c787531b3f18"
Copied!
The vendors section lists the vendors ids that have their purposes for consent and legitimate interests updated by this function call. The output format is as follows:
legIntVendors: ["vendor id 1", "vendor id 2", ...]
1
legIntVendors: Array(1)
2
0: "5f520ca8b8e05c65914d2607"
Copied!
The vendors section lists the vendors ids that have their purposes for consent and legitimate interests updated by this function call. The output format is as follows:
vendors: ["vendor id 1", "vendor id 2", ...]
1
vendors: Array(3)
2
0: "5e37fc3e56a5e6614776722e"
3
1: "5f520ca8b8e05c65914d2607"
4
2: "5e98e7f0b8e05c1c467daaf2"
Copied!
Last modified 2mo ago