Integrate your own consent manager with the Freshpaint Web SDK
Freshpaint supports integrating with a custom consent manager in order to ensure you are respecting your users' data privacy choices while still being able to leverage Freshpaint for sending data to your preferred marketing and advertising platforms.
Prerequisites
This guide assumes you have already set up the Freshpaint Javascript SDK and set up at least one data destination in the Freshpaint app. If not, follow these guides to get set up
The initial_consent object follows the same pattern as the Integrations Object.
Secondly, to ensure that changes to your user's consent are respected, you must set up an event listener on consent changes to update this consent object.
Using the Consent Object
You can pass a consent object into the freshpaint.init function call to set a default/initial state for the user's consent.
To limit which destinations a user's data is sent to, set All: false to ensure user events are not sent to any destinations unless the destination is explicitly set to true.
// if your consent manager has a built-in event listener hook
consentmanager.addEventListener("onConsentSaved", function (consentObject) {
// add internal mapping from consent manager to freshpaint destinations here
const fpConsentObject = mapConsentToFP(consentObject)
freshpaint.set_consent(fpConsentObject)
})
// otherwise
window.addEventListener("onConsentSaved", function () {
// add internal mapping from consent manager to freshpaint destinations
const fpConsentObject = mapConsentToFP(consentmanager.getConsent())
freshpaint.set_consent(fpConsentObject)
})