Hightouch Events offers a pre-built integration for managing user consent with OneTrust.
Prerequisites
Make sure to setup your consent categories in OneTrust before integrating with Hightouch Events.
The integration expects the OneTrust Banner SDK to be available in order interact with OneTrust. This library derives the group IDs that are active for the current user from the window.OneTrustActiveGroups
object provided by the OneTrust SDK (more info).
Installation
The Hightouch Events + OneTrust integration is available via NPM. It can also be installed using a <script>
tag.
npm install @ht-sdks/events-sdk-js-consent-wrapper-onetrust
import { HtEventsBrowser } from '@ht-sdks/events-sdk-js-browser'
import { withOneTrust } from '@ht-sdks/events-sdk-js-consent-wrapper-onetrust'
export const htevents = new HtEventsBrowser()
withOneTrust(htevents).load({ writeKey: 'WRITE_KEY' })
<head>
<!-- OneTrust -->
<script
src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
type="text/javascript"
charset="UTF-8"
data-domain-script="YOUR-DOMAIN-SCRIPT-ID"
></script>
<!-- Hightouch + OneTrust Consent Wrapper -->
<script src="https://unpkg.com/@ht-sdks/events-sdk-js-consent-wrapper-onetrust@latest/dist/umd/htevents-onetrust.umd.js"></script>
<!-- Hightouch Browser SDK snippet -->
<script type="text/javascript">
...
// replace `e.load('WRITE_KEY')` with `withOneTrust(e).load('WRITE_KEY')`
withOneTrust(e).load('WRITE_KEY')
...
</script>
</head>
API
For a full list of features and options, see the README.