[Hydrogen @2025.7.0] Cookie banner works but customerPrivacy functions throw errors and analytics_allowed stays false

Hi everyone :waving_hand:

I’m an intern currently working on a Hydrogen project, and I’ve followed the official Shopify documentation carefully:

:backhand_index_pointing_right: Hydrogen Analytics Tracking Guide![Attachment.tiff](file:///Attachment.tiff)

The project is using @shopify/hydrogen@2025.7.0.

The cookie privacy banner loads correctly for EU countries and can be clicked to “Accept,” but I’m seeing the following errors in the browser console:

Uncaught TypeError: t.customerPrivacy.userCanBeTracked is not a function
window.Shopify.customerPrivacy.analyticsProcessingAllowed is not a function

Also, in the Network tab, the analytics events show:

“analytics_allowed”: false,
“marketing_allowed”: false

Below is part of the code configuration:

export async function loader(args: LoaderFunctionArgs) {
const consent = {
checkoutDomain: customEnv.PUBLIC_CHECKOUT_DOMAIN,
storefrontAccessToken: customEnv.PUBLIC_STOREFRONT_API_TOKEN,
withPrivacyBanner: true,
country: storefront.i18n.country,
language: storefront.i18n.language,
};

return {
…deferredData,
…criticalData,
publicStoreDomain: customEnv.PUBLIC_STORE_DOMAIN,
publicStorefrontId: customEnv.PUBLIC_STOREFRONT_ID,
shop,
consent,
shopId: customEnv.SHOP_ID || ‘’,
shopCurrency: (storefront.i18n as any).currency || ‘USD’,
cookieDomain:
(customEnv.PUBLIC_COOKIE_DOMAIN as string | undefined) ||
(requestHost && requestHost.includes(‘.’)
? .${requestHost.split('.').slice(-2).join('.')}
: ‘’),
gtmId: getGTMContainerByCountry(args.context.storefront.i18n.country),
fbPixelId: customEnv.PUBLIC_FB_PIXEL_ID || ‘’,
clarityId: customEnv.PUBLIC_CLARITY_ID || ‘’,
elevarConfigUrl: customEnv.PUBLIC_ELEVAR_CONFIG_URL || ‘’,
weglotApiKey: customEnv.PUBLIC_WEGLOT_API_KEY || ‘’,
klaviyoApiKey: customEnv.PUBLIC_KLAVIYO_API_KEY || ‘’,
country: args.context.storefront.i18n.country,
marketId: getMarketIdByCountry(args.context.storefront.i18n.country),
};
}

export function Layout({children}: {children?: React.ReactNode}) {
return (
<>
{data && data.shop && data.consent ? (
<Analytics.Provider
cart={data.cart}
shop={data.shop}
consent={data.consent}
>
<PageLayout {…data}>{children}

</Analytics.Provider>
) : (
children
)}


</>
);
}

The banner appears and works visually, but the Shopify Analytics data isn’t being collected — it always reports analytics_allowed: false.

Any help or guidance would be greatly appreciated :folded_hands:

Thanks in advance!

Derek