Articles on: Settings
This article is also available in:

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/hydrogen version in your package.json.


Turn on custom storefront support


  1. Go to Shopify Admin > Apps > Pandectes GDPR Compliance > All settings and open Custom/Headless support.
  2. Click Enable.
  3. 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 ShopifyScripts

Hydrogen 2026.10 or later

Hydrogen before 2026.10, Next.js, or another custom frontend

Older Hydrogen and other frameworks


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.


  1. In Banner snippets, copy the code from Step 1 into the <head> of your root layout, before <ShopifyScripts>.
  2. Skip the consent-tracking-api script tag at the top of the snippet. ShopifyScripts already loads the Customer Privacy API, and a second copy replaces Hydrogen's.
  3. 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.
  4. Banner v2 only: paste the Step 2 snippet (<pandectes-cmp>) right after the opening <body> tag. See Banner v2 component.
  5. Set the consent mode of ShopifyScripts to custom-banner, with a setup that 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();
}),
}}
/>


  1. Remove any older consent configuration from your Hydrogen app: checkoutDomain, storefrontAccessToken and withPrivacyBanner passed to analytics or useCustomerPrivacy.
  2. Leave Storefront access token, Storefront root domain and Checkout root domain empty in Pandectes. Shopify does not use them in this setup.


Do not use 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.


If your app sends a Content-Security-Policy, allow 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.


  1. In Banner snippets, copy the code from Step 1 as high as possible in the <head> of every page, including the consent-tracking-api script tag.
  2. Banner v2 only: paste the Step 2 snippet right after the opening <body> tag.
  3. In Access token & domains, fill in the fields Shopify needs to share consent between your storefront and checkout. See Access token and domains.
  4. Click Save.


On Hydrogen versions before 2026.10, Shopify's checkout keeps the consent it saw on the visitor's first checkout visit and ignores later changes made on the storefront. This is Shopify's behaviour, not a Pandectes setting. Upgrading to Hydrogen 2026.10 and following the setup above fixes it.


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 hydrogen.shop. Leave empty to use default page domain.

Checkout root domain

The domain of your checkout, for example checkout.hydrogen.shop. Leave empty when on production.


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 example IT, US or USCA. 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: true or false, 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


  1. Open your storefront in a private window. The banner shows.
  2. Choose Accept or Reject.
  3. Open the browser console and run:


Shopify.customerPrivacy.currentVisitorConsent()


It should show yes or no for analytics, marketing and preferences, matching your choice.


  1. On Hydrogen 2026.10 or later, also run:


Pandectes.whenDecided().then(console.log)


It prints the decision Shopify has.


  1. 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.



Updated on: 13/11/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!