← Arcanum HollowDocs · 1.2.0

Analytics and GTM

Google Tag Manager container ID and Shopify Customer Privacy consent gating.

Add your **GTM container ID** (format `GTM-XXXXXXX`) under **Theme settings → Analytics**. The theme validates the prefix and length before injecting scripts.

GTM loads only after Shopify **Customer Privacy API** reports that the visitor can be tracked. The head snippet listens for `visitorConsentCollected` before inserting `gtm.js`. `gtm-data-layer.js` still loads from the body scripts bundle for theme events once analytics is configured.

Use Shopify's cookie banner / consent UI in Admin so `userCanBeTracked()` reflects merchant policy. Test consent behavior with `tests/e2e/consent.spec.ts` in the theme package.

Sales channels > Online Store > Themes > Customize > Theme settings > Analytics

Was this page helpful?

Content is maintained by Arcanum Hollow Labs. For internal engineering notes, see the docs/ folder in the monorepo.