__tcfapi postCustomConsent API

Writing consent for Custom Vendors

Certain use cases may require you to change the user's consent profile outside the regular Sourcepoint message and privacy manager flow. Common use cases include vendor-specific consent experiences to handle social media plugins or applying consent because a user has accepted the website's T&Cs or any other publisher or advertiser provided contract. The following function 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).

__tcfapi('postCustomConsent', 2, (data) => console.log(data),
[vendors], [categories], [legIntCategories]

The vendors, categories and legIntCategories arrays take the vendor IDs and category IDs you want to change the consent or legitimate interest status for. Vendor and category IDs can be found in the Vendor List that is activated for your property.

Please note that IAB vendors can only be consented to through a TCFv2 compliant messaging experience. The postCustomConsent method can therefore only be applied to custom vendors that don't require you to adhere to the IAB's mandated user experience.