> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hightouch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hightouch Events + OneTrust

> Hightouch Events with OneTrust consent integration

Hightouch Events offers a pre-built integration for managing user consent with OneTrust.

## Before you begin

Make sure to setup your consent categories in OneTrust before integrating with Hightouch Events.

The integration expects the [OneTrust Banner SDK](https://my.onetrust.com/articles/en_US/Knowledge/UUID-66bcaaf1-c7ca-5f32-6760-c75a1337c226) to be available in order to 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](https://my.onetrust.com/articles/en_US/Knowledge/UUID-66bcaaf1-c7ca-5f32-6760-c75a1337c226)).

## Installation

The Hightouch Events + OneTrust integration is available via [NPM](https://npmjs.org/@ht-sdks/events-sdk-js-consent-wrapper-onetrust). It can also be installed using a `<script>` tag.

**NPM**

```sh theme={null}
npm install @ht-sdks/events-sdk-js-consent-wrapper-onetrust
```

```jsx theme={null}
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' })
```

**Script Tag**

```html theme={null}
<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](https://github.com/ht-sdks/events-sdk-js-mono/tree/master/packages/consent/consent-wrapper-onetrust).
