Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
We’re facing an issue while implementing Google Tag Manager (GTM) custom event tracking with Shopify Hydrogen, specifically in combination with the native Shopify cookie consent banner. We’ve carefully followed Shopify’s official documentation for analytics integration (link: Shopify Analytics Documentation), but we’re encountering problems.
The main issue is that custom events are only firing in sessions after visitor consent has already been collected in a previous session. Based on our understanding of useAnalytics, events should be queued before consent is granted, then fired immediately after consent is given, and continue to work for the rest of the session. We suspect the issue may be tied to the Customer Privacy API interacting with the native cookie banner consent, but we can’t determine the exact cause.
Any help or suggestions would be greatly appreciated! We can provide our deployment URL or offer access to our store for further investigation if needed.
Thanks in advance!