Your cookie banner and accessibility widget already handle the heavy lifting. Sometimes your storefront needs to go one step further: load a script only after marketing consent, open cookie preferences from a footer link, or tie a custom button to the accessibility panel.
That is what the Consentmo Storefront JavaScript API is for. Once Consentmo runs on the page (via the app embed or the Hydrogen script), window.Consentmo is available and your theme or headless storefront can work with live consent and accessibility state.
You do not need the API for Consentmo to work. The banner, preference center, and accessibility widget run on their own. Use the API when you want deeper control and cleaner custom integrations.
What you get
With the script active, developers can:
- Read consent in real time, see whether analytics, marketing, preferences, or necessary categories are allowed
- React when choices change, listen for updates and load or pause tools without a page refresh
- Open preferences from your own UI, footer “Cookie preferences,” privacy page buttons, or custom nav items
- Pass consent from advanced flows, when a custom interface collects choice and Consentmo should stay the source of truth
- Control the Web Accessibility widget, open, close, or toggle the panel; check what adjustments a visitor enabled; show or hide the floating control when it helps the layout
_converted.avif)
The in-app reference lists properties, methods, events, cookie helpers, and accessibility controls in one place.
Benefits for merchants and teams
Privacy-safe custom features
Only run marketing pixels, chat widgets, or personalization after the matching category is allowed. Fewer accidental loads before consent.
Consistent experience across your brand UI
Visitors stay inside your theme design while Consentmo still manages the legal choice, records, and banner logic.
Faster agency and theme work
One stable window.Consentmo surface instead of scraping the DOM or reinventing consent storage.
Better accessibility journeys
Link your own “Accessibility” control to Consentmo’s panel, or adapt layout when visitors enable high contrast, link highlighting, and similar adjustments.
Hydrogen and headless ready
The same idea applies on custom storefronts when Consentmo is installed with the Hydrogen / headless setup and Customer Privacy wiring.
Practical use cases
- Footer cookie link, “Manage cookies” opens Consentmo preferences instead of a dead page.
- Conditional analytics, a custom script checks
analyticsAllowed()(or full consent) before initializing. - Campaign landing pages, listen for consent updates and enable remarketing tags the moment the shopper accepts marketing.
- Brand accessibility button, your header icon calls the accessibility open/toggle methods so the widget matches your design system.
- Agency-built privacy hub, a custom privacy center page reads status, explains choices in your copy, and still relies on Consentmo for the real preference dialog.
- Headless Shopify, Hydrogen (or similar) storefronts keep consent logic aligned with the rest of the stack.
_converted.avif)
Who it is for
- Theme developers and Shopify Plus teams
- Merchants with custom scripts or third-party tools that must respect consent
- Agencies shipping tailored privacy or accessibility UX
- Hydrogen and other headless implementations
If you only need a compliant banner and standard preference center, install Consentmo and skip the API. Reach for it when your storefront needs to talk to consent and accessibility state.
How it works
- Enable Consentmo on the storefront (app embed on Online Store 2.0 themes, or the documented Hydrogen / headless script).
- Confirm
window.Consentmois present in the browser. - Read consent, subscribe to events, open dialogs, or use
window.Consentmo.accessibilityas needed. - Keep visitor choice accurate whenever you update consent from a custom UI.
Exact method names, return shapes, and event constants live in the full reference. This article stays at the product level on purpose.
Get started
Already on Consentmo? Turn on the embed (or Hydrogen script), open the API reference in Settings, and wire one high-value action first, such as a footer preferences link or a consent-gated script.
New to Consentmo? Install Consentmo on Shopify, configure your regions and banner, then add the Storefront JavaScript API where your theme or headless storefront needs custom behavior.
Questions? Our team is available in-app live chat or at support@consentmo.com.

_converted.avif)
_converted.avif)
