hydrogen-analytics
Skill by Shopify
Guides developers adding or reviewing analytics in Hydrogen storefronts. It covers the analytics bus, ShopifyScripts setup, consent-gated destinations, view events and cart tracking. Written for developers building Shopify Hydrogen storefronts.
Install hydrogen-analytics
Built from the published package, never by AI.
git clone --depth 1 https://github.com/Shopify/hydrogen /tmp/hydrogen && mkdir -p ~/.claude/skills && cp -r /tmp/hydrogen/packages/hydrogen/skills/hydrogen-analytics ~/.claude/skills/hydrogen-analyticsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/Shopify/hydrogen /tmp/hydrogen && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/hydrogen/packages/hydrogen/skills/hydrogen-analytics ~/.gemini/antigravity-cli/skills/hydrogen-analyticsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This Shopify skill guides adding or reviewing analytics in a Hydrogen storefront. The Hydrogen analytics bus owns the event API, event normalization and consent-gated destination replay. ShopifyScripts handles Shopify consent setup and analytics CDN loading. App code decides when to publish route and view events and when to call cart tracking.
The skill describes rendering ShopifyScripts once from the document head, using the same market as Storefront API requests. It shows a browser singleton that reads window.Shopify.analytics, and it covers publishing page, product, collection, search and cart view events. Cart changes are tracked with trackCartAnalytics, with React and Vue bindings named. It is aimed at developers building Hydrogen storefronts.
Written from the project's SKILL.md and checked against it.
What it can do
- Page and view eventsPublishes PAGE_VIEWED, PRODUCT_VIEWED, COLLECTION_VIEWED, SEARCH_VIEWED and CART_VIEWED from route boundaries.
- Cart trackingWires trackCartAnalytics(cartStore) so confirmed cart changes publish delta events.
- ShopifyScripts setupExplains rendering Shopify runtime scripts once with the shop and i18n values.
- Consent-gated destinationsCovers registering event consumers with addDestination() under Shopify Customer Privacy consent.
- Custom consent providersPoints to a reference for third-party consent banners using a custom-banner mode.
- Framework route wiringPoints to framework references for route-change analytics, falling back to the core pattern.
What you need
- A Hydrogen storefront
- Shopify ShopifyScripts configuration
- Same-origin SFAPI proxy from the hydrogen-request-handlers skill
- Shopify Customer Privacy consent setup
Try asking
- Add product view analytics to my Hydrogen product page
- Review my Hydrogen storefront analytics for consent gating
- Wire cart change tracking with trackCartAnalytics in my React app
Good to know
- Analytics is incomplete until the same-origin SFAPI proxy is wired.
- Server-side analytics must not be sent through the browser bus.
- trackCartAnalytics throws during SSR, so it must run in a client-only effect.
- Consent must not be bypassed in production.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: packages/hydrogen/skills/hydrogen-analytics/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md6 KB -
references/custom-consent.md4 KB -
references/react.md6 KB -
references/vue.md3 KB
Alternatives to hydrogen-analytics
All alternatives →Shopify skill that lets an AI assistant set up and run a Shopify store through Shopify's official MCP server. It is for people who want to sell online, start a store, or manage an existing Shopify store.
Guides an AI assistant through building Shopify apps, extensions and themes. It covers the GraphQL Admin API, Shopify CLI, Polaris UI and Liquid. Intended for Shopify developers.
Searches Ticketmaster events and seat listings with pricing for people looking for event tickets. It returns Ticketmaster checkout links but cannot complete a purchase itself.
Analyzes ecommerce SEO for product pages, product schema, Google Shopping visibility, Amazon marketplace signals and keyword gaps. Built for stores, catalogs and product listings. Live Shopping and Amazon data needs the optional DataForSEO Merchant API.
Drafts replies to customer emails and tickets using order, refund, CRM and support desk data, in the owner's writing voice. Refunds and sends need the owner's approval, and with Shopify it also flags orders needing attention.
Reviews generated or changed WooCommerce code before it ships. It is for developers building extensions, payment and shipping integrations, checkout customizations, and order or product logic.
Compare with shopify, shopify-development or ticketmaster
hydrogen-analytics: common questions
Does this skill handle analytics consent?
Yes. The source says Shopify Customer Privacy controls destination delivery in production, and visitors who deny analytics consent do not receive destination events.
Can it send server-side analytics events?
No. The source says not to dispatch server-side analytics through the browser bus.
Does it work outside React and Vue?
The skill gives React and Vue cart hooks. For other frameworks it says to adapt page, product, collection, search and cart tracking to the app's own route lifecycle.
How do I install hydrogen-analytics?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is hydrogen-analytics free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is hydrogen-analytics safe to use?
It scores 87 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to hydrogen-analytics?
Similar skills: shopify, shopify-development, ticketmaster, seo-ecommerce.
