If you are using your own privacy management solution or the experience is embedded in a website with its own privacy management preference center, then you can use the Experiences Privacy Management API to pass on the user’s preferences to the experience, as follows:
Embedding an Experience in a Website
1. Sending the privacy settings to Experiences will require a small section of JavaScript to be added to the parent page in an HTML script tag:
<script>
NGX.Embed.registerEventHandler('app:ready', function() {
NGX.Embed.setPrivacyConsents({
functional: true,
analytics: true,
marketing: true,
});
});
</script>
2. The parent page registers an app:ready eventListener callback to know when our app is ready to receive privacy settings.
`NGX.Embed.registerEventHandler("app:ready", function () {})`
3. Set the privacy settings with the function `NGX.Embed.setPrivacyConsents()`. The settings parameter should be in the form of an object with the consent types as property names and a boolean value to indicate if consent is given for that consent type.
4. You do not need to send all the consent type properties, as they will be merged with the default settings. Default settings are as follows:
`{
necessary: true,
functional: false,
analytics: false,
marketing: false,
}`
Note that you may not disable the consent setting for Strictly Necessary cookies, which are always set to true.
Publishing an Experience as a Microsite
1. Sending the privacy settings to Experiences will require a small section of JavaScript to be added to the custom JavaScript area of the experience settings. To find this area, open the `Advanced` panel in the Experience Workspace and click `Customize`. This will open a page where you can access the Edit screen to add the custom JavaScript for this experience’s webpage:
<script>
NGX.App.Events.on("page:ready", function () {
NGX.App.api.setPrivacyConsents({
functional: true,
analytics: true,
marketing: true,
});
});
</script>
2. Register a page:ready eventListener callback to know when our experience is ready to receive privacy settings.
NGX.api('page:ready', function() {});
3. Set the privacy settings with the API call NGX.api('privacy:set:consent', {}). The settings parameter should be in the form of an object with the consent types as property names and a boolean value to indicate if consent is given for that consent type.
4. You do not need to send all the consent type properties, as they will be merged with the default settings. Default settings are as follows:
`{
necessary: true,
functional: false,
analytics: false,
marketing: false,
}`
Note that you may not disable the consent setting for Strictly Necessary cookies, which are always set to true.
Publishing an Experience on a Custom Domain
If you need to add custom privacy management to a custom domain experience, please contact your Customer Success Manager.