Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 87
  • 2.2k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-analytics

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install hydrogen-analytics in Claude Code

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

A

No 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 →

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.

hydrogen-analytics Install

Add to stack

Loading.