> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/collect-data/shopify/browser-events/consent.md). Agents can also search and read this documentation through its [MCP server](https://docs.chord.co/~gitbook/mcp).

# Consent

Chord uses Shopify's [Customer Privacy API](https://shopify.dev/docs/api/customer-privacy) to respect each shopper's consent choices. Events only reach the destinations a shopper has consented to, which helps you comply with privacy laws such as GDPR and CCPA. Beyond the settings on this page, the only consent setup is the `consent: 'shopify'` option in your analytics package configuration, which the [browser events](https://docs.chord.co/collect-data/shopify/browser-events.md) snippet already includes. Headless stores should set it too, and must also [carry consent to checkout](#hydrogen-and-headless-storefronts-carry-consent-to-checkout).

## How it works

1. Shopify asks the shopper for consent through your cookie banner.
2. Shopify only loads the Chord web pixel once the shopper allows both analytics and marketing. Until then, the pixel sends nothing. Events your theme sends through the analytics package itself still go to Chord, stamped with the shopper's choices, and your consent categories decide which destinations get them.
3. Once loaded, the pixel attaches a `consent` object to every event, recording the shopper's choice for each consent category.
4. Chord uses your consent category mappings to decide which destinations receive each event.

## Step 1: Set the pixel's privacy settings

In Shopify admin, go to **Settings > Customer events**, open the Chord pixel, and set **Customer privacy** as follows:

* **Permission:** select **Required**, and check **Marketing** and **Analytics**. This makes Shopify fill in the consent values the pixel reads. Without these boxes checked, the consent values may not reflect the shopper's real choices.
* **Data sale:** select **Data collected qualifies as data sale**. This makes Shopify report when a shopper opts out of the sale of their data, for example under CCPA. With "does not qualify", Shopify reports the sale of data as allowed even after a shopper opts out.

![Customer privacy settings for the Chord pixel](https://2938842758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5Oy2IAsu7IvAGAlWgC36%2Fuploads%2Fgit-blob-bd83a60e526b8ce5d84cf1c43f3f55d7d9bdac23%2Fshopify-pixel-privacy-settings.png?alt=media)

## Step 2: Turn on Shopify's customer privacy features

In Shopify admin, go to **Settings > Customer privacy**.

**Cookie banner (required).** Chord's consent handling needs a cookie banner. Without one, the Customer Privacy API isn't available and Chord sends no events at all.

* To use Shopify's banner: select **Cookie banner > Activate cookie banner**, choose the regions where it should appear, and click **Activate**.
* To use a banner app from the Shopify App Store: select **Cookie banner > More actions > Use custom cookie banner**, choose regions, and click **Activate**.

**Data sales opt-out page (recommended).** This lets shoppers control whether their data is shared with third parties. Select **Data-sales opt-out page**, choose regions, and click **Activate**.

See Shopify's guide to [customer privacy settings](https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings) for more.

## Step 3: Create consent categories in Chord

Shopify's Customer Privacy API has four consent categories. Create a matching consent category in Chord for each, then choose which destinations belong to it. A destination in a category only receives an event if the shopper consented to that category.

In Chord, go to **CDP > Consent Categories > Create Your First Consent Category** and add these four. You can name them however you like, but the category ID must match exactly:

* **Performance cookies**, ID `analytics`: how shoppers use and interact with your storefront.
* **Marketing cookies**, ID `marketing`: marketing, attribution and targeted advertising.
* **Preference cookies**, ID `preferences`: shopper preferences such as language, currency and size.
* **Sale of data**, ID `sale_of_data`: sharing data with third parties, usually for behavioral advertising. Collected by Shopify's data sales opt-out page.

When all four are created and enabled, the list looks like this:

![Consent categories in Chord](https://2938842758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5Oy2IAsu7IvAGAlWgC36%2Fuploads%2Fgit-blob-cc17bbfb23276fa81294a4f55d79d4e6035fed80%2Fconsent-categories-shopify.png?alt=media)

## Hydrogen and headless storefronts: carry consent to checkout

On a Hydrogen or headless store, checkout runs on a separate Shopify domain, such as `checkout.your-store.com`, and keeps its own record of the shopper's consent. A shopper's choice on your storefront doesn't reach checkout unless your storefront passes it along. Without it, checkout falls back to the default for the shopper's region.

In regions where privacy laws require consent, such as the EU, the UK and several US states including California, the default denies analytics and marketing. Shopify then doesn't load the Chord web pixel at checkout, even for shoppers who accepted your cookie banner, so their checkout events never reach Chord. Server events such as Order Completed still arrive, because they don't depend on consent.

**Symptom.** Orders that have a server Order Completed but no checkout browser events, concentrated in regions that require consent. Stores in regions without these laws seem unaffected, because their defaults allow tracking.

Shopify carries consent to checkout in a `_cs` parameter on the cart's `checkoutUrl`. How you get it there depends on your setup.

### Hydrogen with Hydrogen's analytics provider

Recent Hydrogen versions carry consent to checkout for you. If you use a cookie banner app instead of Shopify's banner, connect it through Hydrogen's custom banner consent mode, and map every choice to all four categories, including `sale_of_data`. See Shopify's guide to [analytics and consent in Hydrogen](https://shopify.dev/docs/storefronts/hydrogen/analytics).

If you're on an older Hydrogen version and see the symptom above, upgrade Hydrogen, or pass consent on your cart as described in the next section.

### Custom headless storefronts, or carts your own code creates

If you build the cart, or fetch its `checkoutUrl`, with your own Storefront API calls, pass the shopper's consent with the `visitorConsent` argument of the `@inContext` directive. Shopify then adds `_cs` to the `checkoutUrl` it returns. This needs Storefront API version 2025-10 or later. See Shopify's [`@inContext` visitor consent changelog](https://shopify.dev/changelog/posts/incontext-directive-supports-visitor-consent-for-privacy-compliant-checkouts).

1. In the shopper's browser, when they click your checkout button, read what each category allows from the Customer Privacy API:

   ```js
   const privacy = window.Shopify.customerPrivacy;

   const visitorConsent = {
     analytics: privacy.analyticsProcessingAllowed(),
     marketing: privacy.marketingAllowed(),
     preferences: privacy.preferencesProcessingAllowed(),
     saleOfData: privacy.saleOfDataAllowed(),
   };
   ```

   These methods return the shopper's choice where they made one, and the region's default where they didn't, so checkout ends up with the same answer as your storefront. Don't use `currentVisitorConsent()` for this. It only reports choices the Customer Privacy API recorded itself, and it can return empty values even after a shopper accepts your banner.

   If you use a cookie banner app, first check that these methods reflect the banner. Accept the banner, then run them in the browser console. If they return `false` after an accept, the app isn't passing consent to the Customer Privacy API: read each category from the app's own API instead, and ask the app's support to fix the sync.
2. Add `visitorConsent` to the cart query or mutation that returns the `checkoutUrl` you send the shopper to, passing each value as a variable. If that call runs on your server, send `visitorConsent` from the browser with the request.

   ```graphql
   mutation CartCreate(
     $input: CartInput!
     $analytics: Boolean
     $marketing: Boolean
     $preferences: Boolean
     $saleOfData: Boolean
   )
   @inContext(
     visitorConsent: {
       analytics: $analytics
       marketing: $marketing
       preferences: $preferences
       saleOfData: $saleOfData
     }
   ) {
     cartCreate(input: $input) {
       cart {
         checkoutUrl
       }
     }
   }
   ```
3. Send the shopper to `checkoutUrl` exactly as Shopify returns it. Don't remove `_cs`, and don't build it yourself: its format isn't documented and can change.

### Check that consent reaches checkout

1. Open a private browser window in a region that requires consent, such as California. A VPN works.
2. Accept your cookie banner, add a product to the cart and go to checkout.
3. Check that the checkout URL includes `_cs`, and that your browser's network tab shows requests from the Chord pixel.
4. Place a test order, then [check that the events arrived](https://docs.chord.co/collect-data/send-a-test-event.md), including Checkout Started from the pixel.

## The consent object

The pixel builds the `consent` object on every event from Shopify's Customer Privacy API:

```json
{
  "analytics": true,
  "marketing": true,
  "preferences": true,
  "sale_of_data": false
}
```

Each value comes from one Shopify method:

* `analytics`: `customerPrivacy.analyticsProcessingAllowed()`
* `marketing`: `customerPrivacy.marketingAllowed()`
* `preferences`: `customerPrivacy.preferencesProcessingAllowed()`
* `sale_of_data`: `customerPrivacy.saleOfDataAllowed()`

## Server events

Consent only applies to browser events. Server events from the Chord Webhook Events app, such as Order Completed, Order Refunded and fulfillments, carry no consent information, because consent is only known in the shopper's browser. Chord treats them as consented and sends them to every connected destination, even one with consent requirements. That keeps your transactional data complete in every tool.

## Global Privacy Control

Chord treats the [Global Privacy Control](https://globalprivacycontrol.org/) signal as an opt-out of the sale of data. If a shopper has GPC turned on in their browser and is in a region where opting out is supported, `sale_of_data` is `false`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/collect-data/shopify/browser-events/consent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
