eCommerce developmentApp developmentCustom developmentHeadlessMigrationReplatformingConsultingWeb designUX/UI designIntegrationMaintenanceShopify developmentShopify Website Development ServicesShopify Store DevelopmentShopify Speed OptimizationShopify Plus Development CompanyShopify Theme DevelopmentProfessional Shopify App Development ServicesProfessional Shopify Migration ServicesExpert Shopify CRO ServicesShopify Website Design ServicesShopify Development CompanyShopify Theme Customization ServicesShopify IntegrationShopify Store SetupShopify Conversion Rate OptimizationCustom softwareSaaS Development ServicesBlockchain Development ServicesFinancial Software Development ServicesMVP developmentConsultingMobile appsWeb portalsAI softwareMagento developmentIT staff augmentationBeringCa'PietraCultnaked – Fashion StoreIntoSocialWorld Jewish Travel - AI AssistantCote&CielBiomaAfterCartHey HolyBears with benefitsVintage furniture sellerBaketivityStellar SEO AppKing of ChristmasChemist4YouEasy ToolErgoBabyRevenue ForecastingNLPG MasterbookSelena TitanNetparcelBeautyInsighterCopperMountainAI Call QA PlatformAlbertbowWorld Jewish TravelGolden State UrologyLGFG Fashion HouseGLOCK WatchesWhat Is Agentic Commerce? The Next Revolution in Digital ShoppingHow Much Does AI App Development Cost in 2026?5 Signs Your AI App Isn’t Ready for LaunchWhy Modern Consumer Brands FailFrom Store Staff to eCommerce Director: Scaling a Norwegian Denim Brand Globally

Headless Shopify Hydrogen Store for GLOCK Watches with A/B Testing

How we built a headless store for GLOCK Watches from scratch on Shopify Plus, using Hydrogen and Oxygen for the EU and US markets. After launch, the project moved into ongoing development: A/B testing, product analytics, and end-to-end attribution that links each experiment to actual purchases.

Jack Ananchenko

Reviewed by: Jack Ananchenko, Co-founder, CEO

Nov 25, 20267 min read
USAEUUSA · EU
Headless Shopify Hydrogen Store for GLOCK Watches with A/B Testing

GLOCK Watches – glockwatches.com

E-commerce / Premium Watches & Accessories, GLOCK’s D2C watch business

The Essentials

Shopify Plus Development

Headless Commerce / Shopify Hydrogen Development

CRO

UX/UI Design

Full-time: Project Manager

3 Developers

2 QA Engineers

May 2023 – present

50K+ sessions in 30 days

2 Regional Storefronts (EU & US)

Tech Stack

Shopify PlusHydrogenRemix 2OxygenGraphQL Storefront API

Building GLOCK Watches’ D2C Store from Scratch: Why Headless on Shopify Plus

Before the project, GLOCK Watch Collection had no dedicated online store. GLOCK already had a large, loyal audience, so even a small change in conversion rate could have a meaningful commercial impact on the new D2C business. The store also had to follow GLOCK’s brand guidelines closely.

We proposed a headless architecture using Shopify Plus and Hydrogen: we build the frontend ourselves, while Shopify handles the catalog, cart, and checkout.

After launch, the next phase began: systematic CRO. Changes to the homepage, product listing pages (PLPs), and product detail pages (PDPs) were tested as hypotheses, with each experiment variant linked to actual purchases.

Three things we're proud of

1,000

Lines of Code Removed

We removed this much custom code after moving authentication (login, registration, and password recovery) to the Shopify Customer Account API.

From SSR to Purchase

PostHog A/B tests are tracked from server-side rendering through to a completed purchase in Shopify.

1.7s

Mobile LCP

The largest element in the initial viewport appears in 1.7 seconds on mobile.

The Challenge: Linking A/B Tests on Shopify Hydrogen to Actual Purchases

After launch, the main CRO challenge was reliably measuring the results of each interface variant. An experiment starts during server-side rendering, continues on the client and in the cart, and ends on Shopify’s separate checkout page. The system also had to account for two regional storefronts, geolocation, localization, and user consent to cookies.

End-to-End Experiment ID

We needed to preserve posthog_distinct_id and active experiment keys from SSR through to the purchase event so revenue could be correctly attributed to a specific test.

Two Storefronts, Two Languages

The EU and US storefronts each had their own settings, location-based prompts, and German and English language options. Experiment data had to remain consistent as users moved between regions.

Cookie Consent Without Data Loss

The cookie consent banner, GTM/GA, PostHog, and advertising tags had to work together without duplicate events or lost attribution, while meeting GDPR requirements.

The Solution: Shopify Hydrogen, Two EU/US Storefronts, and PostHog A/B Testing

We chose Hydrogen deliberately: it gave us control over the custom frontend and allowed us to implement the design and UX within GLOCK’s strict brand guidelines. The trade-off is that most Shopify apps built for Liquid themes cannot simply be plugged into a headless store, so some features had to be integrated or built separately.

Headless on Shopify Plus: What Shopify Handles and What Hydrogen Handles

Shopify handles the catalog, cart, and checkout, while Hydrogen, built on Remix, powers the custom frontend. The store runs on Oxygen, Shopify’s edge hosting platform, and retrieves data through the GraphQL Storefront API.

Two EU and US Storefronts from One Codebase

The public storefronts are glockwatches.eu and glockwatches.com. Both are built from a single codebase: the STORE=EU|US variable determines which one to build, and each is deployed to Oxygen as a separate storefront. GeoModal, Oxygen buyer headers, and cross-store redirects help direct users to the appropriate version, while the interface supports German and English.

PostHog A/B Testing: From Server-Side Rendering to Purchase

PostHog feature flags are fetched during SSR. The posthog_distinct_id and active experiment keys are then passed through the client and cart attributes, and a Shopify Custom Pixel sends the checkout_completed event to PostHog along with this data. This links each test to purchases as well as on-page behavior.

Landing Pages Built with Shopify Metaobjects and Custom Modules

Landing pages are assembled from sections defined in Shopify Metaobjects, with each section rendered by a separate React component. Estimated delivery times on PDPs, a free extra item in the cart, and the First Responder / repair portal are implemented as separate modules.

After Launch: CRO Iterations and CI/CD

After launch, the store continues to evolve through short iterations on the same architecture, without major rewrites.

CRO iterations. The team tests changes to the homepage, PDPs, and PLPs on real traffic using PostHog feature flags.

Releases via GitHub Actions. A push or PR to main or dev-stage triggers a deployment to Oxygen through GitHub Actions, and each PR gets its own preview environment. Rolling back involves a git revert followed by a redeployment.

Technical Details: Keeping A/B Tests Connected from Hydrogen to Shopify Checkout

1. Engineering Journey: What We Reworked and Rolled Back

The project started with a Shopify demo store and our first attempts to deploy to Oxygen. In the early commits, the team fixed CI/CD and YAML configurations until deployments were stable.

The initial custom useAnalytics was later replaced with Hydrogen Analytics. The existing login, registration, and password recovery flows were migrated to the Shopify Customer Account API, allowing us to remove around 1,000 lines of custom code.

The CRO work was not linear either. The Quick CRO implementation in PR #464 was rolled back, as was Hero v3. On the homepage and PDPs, the split tests were eventually consolidated into the new version: the old version was kept as a fallback, with feature flags retained for measurement. The control/new test on PLPs is still active.

GTM/GA also required several rounds of rework: removing duplicate events, moving scripts between head and body, migrating cookies and consent handling, and rolling back individual hotfixes.

2. The Hardest Part: Preserving Experiment Identity from Hydrogen to Shopify Checkout

The hardest part was preserving experiment identity throughout the customer journey:

SSR PostHog flags → client bootstrap → cart attributes → Shopify Custom Pixel → checkout_completed

The final step cannot be implemented in the store’s code: checkout runs on Shopify, separately from Hydrogen. The Custom Pixel therefore has to be added manually under Shopify Admin → Customer events.

This chain had to work across two storefronts, alongside geolocation, localization, and consent handling. Consentmo, Google Consent Mode v2, and CookieBar control tracking based on the user’s choices.

3. Resilience on Peak Days: PostHog Fallback, Redirects, and CSP

For a brand with new model drops and a busy pre-Christmas season, downtime on peak days is unacceptable, so the storefront is built to withstand third-party service failures. The server-side posthog.server.js file, at around 895 lines of code, handles SSR flags, GeoIP, health logging, and fallback behavior. If PostHog returns an error or its quota is exhausted, the user sees the control variant instead of a broken experiment.

For URLs that do not exist, storefrontRedirect checks the redirects configured in Shopify before returning a 404. A CSP was put together, but its header was left disabled for compatibility with some third-party scripts: a deliberate trade-off between a stricter policy and functioning integrations.

4. Custom Headless Store Modules

  • TrackingAttributesSync – passes gclid, msclkid, and fbclid to cart attributes.

  • ShippingRatesBlock – displays estimated delivery times in business days on PDPs and retrieves rates from a separate Remix app.

  • Free Product Cart Module – manages a free extra item in the cart through Shopify Metaobjects.

  • First Responder / repair portal – a separate customer flow within the storefront.

  • llms.txt – a structured file for LLMs and AI agents.

5. Tech Stack

  • Core (at the time of development): Shopify Plus, Hydrogen 2024.10, Remix 2, Oxygen, Vite 6, GraphQL Storefront API

  • Frontend: Tailwind CSS, Framer Motion, Swiper, Headless UI

  • Localization: i18next, remix-i18next

  • Experimentation: PostHog, Hotjar, Microsoft Clarity

  • Analytics: GTM, GA4, Elevar

  • Ads & Marketing: Meta Pixel, Reddit Pixel, Klaviyo

  • Consent: Consentmo, Google Consent Mode v2, CookieBar

  • Utilities: worktop, schema-dts, ua-parser-js

  • Security: reCAPTCHA

  • CI/CD: GitHub Actions, oxygenctl-action@v4

Results: A Shopify Hydrogen Headless Store Ready for A/B Testing

For Shoppers

Shoppers got a store with a custom design built around GLOCK’s brand guidelines, rather than an adapted off-the-shelf theme. The EU and US have separate regional storefronts with German and English localization, location-based prompts, and cross-store navigation. PDPs show estimated delivery times, a First Responder / repair portal is available separately, and the cart includes a free extra item. Mobile LCP is 1.7 seconds.

For CRO and Product Teams

The team now has infrastructure that tracks an A/B test from the SSR feature flag through to checkout_completed. The homepage, PLPs, and PDPs can be tested using feature flags. If PostHog is unavailable, shoppers simply see the control version of the page.

For Development

Both storefronts evolve from a single codebase, with each change automatically deployed to Oxygen within minutes and a separate preview environment for review. Around 338 PRs have been merged into the main branch over the course of the project, with 100–170 commits per month during the busiest months of 2023.

The project has been running for over three years, from the launch of the headless store on Shopify Plus to an ongoing cycle of CRO, analytics, releases, and technical iterations.

  • linkedin
  • x
  • facebook
  • Clutch
  • Upwork
  • Reddit

Planning a Headless Store on Shopify Plus or A/B Tests on Hydrogen?

We can help you design a headless architecture, set up experimentation infrastructure, and connect product changes to actual purchase data.


Jack ananchenko

Jack Ananchenko

CEO and Co-founder

Vladimir gubarev

Vladimir Gubarev

COO and Co-founder

By submitting this form, you agree to our Privacy Policy and Terms & Conditions.

How We Can Help You

See What Else We've Built