consent
One interface for consent, and an adapter per consent management platform.
Get started
Install the package with the peer dependencies it needs. It comes from the Evolve registry, which needs a one-time sign-in.
pnpm add @evolve-storefront/consent reactRequirements1
react>=19Wrap your app in
ConsentProvider. Setup lists its props.
Then render it on a page:
"use client";
import { createUsercentricsAdapter } from "@evolve-storefront/consent/adapters/usercentrics";import { ConsentProvider, useConsent } from "@evolve-storefront/consent/provider";import type { ReactNode } from "react";
// Which Usercentrics services count as which category is decided per tenant.const adapter = createUsercentricsAdapter({ services: { analytics: ["Wom6s1CtF"], marketing: ["jzMEq56vW"] },});
export function Providers({ children }: { children: ReactNode }) { return <ConsentProvider adapter={adapter}>{children}</ConsentProvider>;}
export function MarketingPixel() { const { granted } = useConsent(); return granted.marketing ? <script src="https://pixel.example/p.js" async /> : null;}Hooks
1 hook to read and change the data yourself, for when you build your own UI. The example above only needs useConsent. All hooks
More in this package
- Setup and server: what the package needs in your project.
- Advanced: other functions and constants, types.

