Custom storefront
Overview
Pandectes runs on headless and custom Shopify storefronts too: Hydrogen, Next.js, or any frontend you build on the Storefront API. Instead of the theme app embed, you paste a few scripts into your storefront. The banner then collects consent and passes it to Shopify's Customer Privacy API, which applies it to Shopify analytics, pixels and checkout.
How you install it depends on your framework. Hydrogen 2026.10 or later loads Shopify's consent tooling for you through ShopifyScripts, so the setup is different from older Hydrogen versions and other frameworks. This article covers both.
Before you start
- Plan: turning on custom storefront support needs the Premium plan. The install snippets and the Access token & domains settings need the Enterprise plan.
- Banner version: the snippets follow the banner your store uses (legacy banner or the new banner). Banner v2 has one extra snippet for the page body.
- Your framework version: for Hydrogen, check the
@shopify/hydrogenversion in yourpackage.json.
Turn on custom storefront support
- Go to
Shopify Admin > Apps > Pandectes GDPR Compliance > All settingsand open Custom/Headless support. - Click Enable.
- The page now shows the Banner snippets and the widget snippets you can copy.
Saving the settings on this page also publishes your store's Pandectes settings file. If you change banner settings later, the storefront picks them up from that file.
Choose your setup
Your storefront | Follow |
|---|---|
Hydrogen 2026.10 or later, with | |
Hydrogen before 2026.10, Next.js, or another custom frontend |
Hydrogen 2026.10 or later
ShopifyScripts loads Shopify's Customer Privacy API and, in custom-banner mode, waits for your consent banner before it releases analytics events. Pandectes tells it when the visitor has decided.
- In Banner snippets, copy the code from Step 1 into the
<head>of your root layout, before<ShopifyScripts>. - Skip the
consent-tracking-apiscript tag at the top of the snippet.ShopifyScriptsalready loads the Customer Privacy API, and a second copy replaces Hydrogen's. - Legacy banner on Hydrogen 2026.10.0 to 2026.10.2 only: uncomment the line
<script>window.pandectesShopifyScripts = true;</script>. From 2026.10.3, Pandectes detects Hydrogen by itself. Banner v2 does not need this line. - Banner v2 only: paste the Step 2 snippet (
<pandectes-cmp>) right after the opening<body>tag. See Banner v2 component. - Set the consent mode of
ShopifyScriptstocustom-banner, with asetupthat waits for Pandectes:
<ShopifyScripts
consent={{
mode: 'custom-banner',
setup: () =>
new Promise((resolve) => {
const tick = () =>
window.Pandectes?.whenDecided
? window.Pandectes.whenDecided().then(() => resolve())
: setTimeout(tick, 50);
tick();
}),
}}
/>
- Remove any older consent configuration from your Hydrogen app:
checkoutDomain,storefrontAccessTokenandwithPrivacyBannerpassed to analytics oruseCustomerPrivacy. - Leave Storefront access token, Storefront root domain and Checkout root domain empty in Pandectes. Shopify does not use them in this setup.
mode: 'default-banner'. It shows Shopify's own privacy banner next to the Pandectes banner.Pandectes.whenDecided() resolves once Shopify has the visitor's choice. On a page where the banner does not ask (for example the banner is switched off, or the visitor is outside the regions you target), it resolves straight away with what Shopify holds. Either way, Hydrogen only sends analytics events while Shopify allows analytics for that visitor.
On Hydrogen 2026.10, checkout follows the visitor's latest choice: the checkout link carries the current consent, so a change made after a first visit to checkout reaches checkout too.
https://*.pandect.es for scripts, connections and images. If your banner shows a logo uploaded in Pandectes, allow your store's own CDN for images too.Older Hydrogen and other frameworks
On Hydrogen before 2026.10, Next.js and other custom frontends, your storefront loads Shopify's Customer Privacy API itself.
- In Banner snippets, copy the code from Step 1 as high as possible in the
<head>of every page, including theconsent-tracking-apiscript tag. - Banner v2 only: paste the Step 2 snippet right after the opening
<body>tag. - In Access token & domains, fill in the fields Shopify needs to share consent between your storefront and checkout. See Access token and domains.
- Click Save.
Access token and domains
These fields are only for storefronts that load Shopify's Customer Privacy API themselves. On Hydrogen 2026.10 or later with ShopifyScripts, leave all three empty.
Field | What to enter |
|---|---|
Storefront access token | Your public Storefront API access token, from the Headless (or Hydrogen) sales channel in Shopify Admin. |
Storefront root domain | The root domain of your storefront, for example |
Checkout root domain | The domain of your checkout, for example |
Banner v2 component
Banner v2 renders through a <pandectes-cmp> element that you place right after the opening <body> tag. Its attributes:
data-locale: two-letter language code of the page. Required.data-region: the visitor's country or state code, for exampleIT,USorUSCA. Required if you turn off Use Pandectes Geo-IP database.data-customer: the logged-in customer's id, saved with their consent. Optional.data-preview:trueorfalse, to respect admin mode. Optional.
Country/state detection (banner v2 only): with Use Pandectes Geo-IP database on, Pandectes detects the visitor's country and state itself. If you turn it off, pass the region in data-region from your framework.
Add the widgets
The page also has snippets for the EU Withdrawal, Customer data requests, Do not sell my data and Cookies declaration pages. Paste each one on the page where the widget should appear.
On Hydrogen 2026.10 or later, skip the consent-tracking-api script tag in these snippets too.
Verify on your storefront
- Open your storefront in a private window. The banner shows.
- Choose Accept or Reject.
- Open the browser console and run:
Shopify.customerPrivacy.currentVisitorConsent()
It should show yes or no for analytics, marketing and preferences, matching your choice.
- On Hydrogen 2026.10 or later, also run:
Pandectes.whenDecided().then(console.log)
It prints the decision Shopify has.
- Add a product to the cart, go to checkout, return to the storefront, change your choice, and go to checkout again. On Hydrogen 2026.10 or later, checkout follows the new choice.
Related articles
- Does the app work on headless stores?
- How to verify that Pandectes works with the Shopify Customer Privacy API
- How the app works with Shopify's Customer Privacy API
Updated on: 13/11/2026
Thank you!
