# Integrating OneTrust with Shopify

[OneTrust](https://onetrust.com) provides a comprehensive way to manage users' cookie preferences, and ensure [GDPR cookie compliance](/partner-recipes/cookie-consent-integrations/shopify-customer-consent-api.md).

OneTrust's app relays these consent choices to Shopify, and Littledata then picks up the cosent choices to automatically update consent in common marketing data destinations.

Here's how to set up OneTrust with Shopify for cookie compliance.

## 1. Install the OneTrust Shopify app

OneTrust's [Shopify app](https://apps.shopify.com/onetrust-consent-management) syncs the consent states with Shopify's customer privacy API.

You can [change the mapping](https://my.onetrust.com/s/article/UUID-a19a7752-4386-f65f-f109-fd6bde724bcf?language=en_US) of OneTrust Category IDs to Shopify consent categories in their app.

![OneTrust Shopify mapping](/files/slV3LM1EV1uRDQYGLh7Q)

We recommend this mapping:

| Shopify category | OneTrust Category ID |
| ---------------- | -------------------- |
| Analytics        | C0002                |
| Marketing        | C0004                |
| Sale of data     | -                    |
| Preferences      | C0003                |

## 2. Install Littledata's app

Install Littledata's [Shopify to Google Analytics](/integrations/shopify-to-google-analytics/littledata-shopify-install-guide.md) or [Shopify to Segment](/integrations/shopify-to-segment/installation.md) connection.

If you previously had Littledata installed, ensure that **Respect user tracking consent** is enabled in the [data pipeline settings](/advanced/developer/data-pipeline-settings.md).

## 3. Tracking respects OneTrust choices

For Google, the consent is used in [Consent Mode v2](https://github.com/littledata/helpcenter-content/blob/main/posts/using-google-consent-modev2/README.md).

For other marketing channels (e.g. Meta, TikTok) the event tracking is turned on if users are opted into **Marketing** coookies.

For Segment, we [pass the full consent object](https://github.com/littledata/helpcenter-content/blob/main/posts/segment-consent-management/README.md) in all events for use with Segment Consent Management and in downstream destinations.

## How this looks

Here's an example of OneTrust setup with Age UK.

![Age UK cookie popup](https://res.cloudinary.com/littledata/w_1024,h_401,c_fit/littledata-blog-images/2021/06/Screenshot-2021-06-09-at-15.00.08.png)

When the user clicks "Accept all Cookies", the tracking in Littledata starts and consent is updated in downstream destinations.

![Age UK cookie settings](https://res.cloudinary.com/littledata/w_1024,h_557,c_fit/littledata-blog-images/2021/06/Screenshot-2021-06-09-at-15.01.33.png)

Then, if the user opts out of "Cookies for performance", the tracking stops.

## How this works

When consent choices are updated in OneTrust, Littledata gets a callback from Shopify with the updated cookie consent preferences.

e.g. if the user has consented to 'Cookies for performance' (tracked as category `C0002` in OneTrust's consent preferences), the `userCanBeTracked()` field is set to `true`in Shopify and Littledata's passes cookies to Google Analytics.

This will also work with any other [cookie banner apps](/partner-recipes/cookie-consent-integrations/shopify-customer-consent-api.md) which integrate with Shopify's Customer Privacy API.

If the user later revokes consent to Cookies for performance, then `userCanBeTracked()` is set to `false`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.littledata.io/partner-recipes/cookie-consent-integrations/integrating-onetrust-shopify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
