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])
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.