analytics/analytics-provider
@replohq/sdk/analytics/analytics-provider
useAnalytics
Returns the AnalyticsSink from the nearest AnalyticsProvider. Throws if used outside of an AnalyticsProvider.
useAnalyticsOptional
Returns the AnalyticsSink if an AnalyticsProvider is present, or null otherwise. Does not throw — safe to use in components that may render with or without analytics.
analytics/hooks/use-product-viewed-analytics
@replohq/sdk/analytics/hooks/use-product-viewed-analytics
useProductViewedAnalytics
Fires a productViewed analytics event when the product or selected variant changes. Deduplicates by product+variant ID so the same combination is only tracked once per component lifecycle.
analytics/hooks/use-collection-viewed-analytics
@replohq/sdk/analytics/hooks/use-collection-viewed-analytics
useCollectionViewedAnalytics
Fires a viewCollection analytics event carrying the collection’s products once the collection and its product list are both available. Re-renders and product-list updates for the same collection do not fire again; a different collection does, and returning to an earlier one counts as a new view, matching useProductViewedAnalytics.