Hydrogen provides recommended patterns for collecting and transmitting website metrics to Shopify analytics, which enables you to view metrics in real time, directly in the Shopify admin. ## Consent tracking for analytics Before you can track analytics on your Hydrogen storefront, ensure you comply with customer consent regulations.

Tracking consent with Shopify (recommended)

Use Shopify’s built-in Customer Privacy API and native cookie banner to get consent

Third-party consent management services

Integrate a third-party consent tracking service into Hydrogen

## Tracking analytics events Analytics is built into Hydrogen, but you can implement it manually if required. You should also check that it's working as expected.

Add Analytics components to Hydrogen

Manually upgrade an older version of Hydrogen to use the built-in Analytics components

Validate your analytics data

Check that analytics data is flowing and troubleshoot common issues