Skip to main content

Breaking Migration: Analytics v2

Breaking Migration: Analytics v2

Mandatory cutover guide for Product + Category Analytics v2.

Audience: Frontend, backend, and data teams migrating analytics consumers.

Critical: This migration is fully breaking. Legacy routes, legacy fields, and compatibility adapters were removed on February 16, 2026.

Scope

This migration applies to:

  • Product analytics API consumers
  • Category analytics UI/API consumers
  • Dashboard analytics pages using product/category revenue fields

Out of scope:

  • Legacy client compatibility and dual-run strategy
  • Route aliases for removed v1 product analytics endpoints

Removed vs Replacement Endpoints

Removed EndpointReplacement EndpointNotes
GET /api/v1/analytics/product/sites/:siteId/top-revenueGET /api/v1/analytics/product/:siteId/topTop response now includes mandatory currency.
GET /api/v1/analytics/product/:siteId/bought-togetherGET /api/v1/analytics/product/:siteId/associations?source=purchaseMerged associations contract.
GET /api/v1/analytics/product/:siteId/added-to-cart-togetherGET /api/v1/analytics/product/:siteId/associations?source=cartmode supports all|session|cart.
GET /api/v1/sites/:siteId/products (analytics usage)GET /api/v1/analytics/product/:siteId/catalogPicker data moved under analytics permission scope.

New Product Analytics Endpoint Set (v2)

GET /api/v1/analytics/product/:siteId/catalog
GET /api/v1/analytics/product/:siteId/overview
GET /api/v1/analytics/product/:siteId/associations
GET /api/v1/analytics/product/:siteId/dwell-time
GET /api/v1/analytics/product/:siteId/tracking-status
GET /api/v1/analytics/product/:siteId/top

Contract Changes

FieldRequiredTypeUsed by eventsDescription
productItemCodeRemoved (query contracts)stringproduct overview / associations / dwell-time queriesDo not send this query field in v2.
productIdRequireduuidproduct overview / associations / dwell-time queriesCanonical product identity in all product analytics drilldowns.
sourceRequired (associations)purchase|cartproduct associationsSelect association stream in merged endpoint.
modeOptionalall|session|cartproduct associationsNarrow cart association aggregation strategy.
currencyRequired (response)stringproduct top rowsFrontend must format top-product money fields with response row currency.
revenueByCurrencyRequired (response)Array<{ currency, revenue, orders, avgOrderValue }>category conversion responseCategory conversion monetary fields are now split by currency. Mixed scalar totals are removed.

Mandatory Migration Steps

1

Drop legacy routes from clients

Delete old product analytics endpoint usage and old hook imports.

Remove bought-together, added-to-cart-together, and top-revenue route calls.
2

Switch all drilldowns to productId

Update query builders and typed contracts.

Send productId UUID to overview/associations/dwell-time.
3

Use analytics catalog endpoint

Load product picker data from analytics scope.

GET /api/v1/analytics/product/:siteId/catalog?search=&page=1&limit=50
4

Adopt merged associations endpoint

Replace split purchase/cart routes.

GET /api/v1/analytics/product/:siteId/associations?productId=<uuid>&source=purchase&mode=all
5

Normalize currency usage

Remove hardcoded EUR/USD for analytics revenue rendering and adopt per-currency rows.

Use product row currency and category conversion revenueByCurrency[] entries.
6

Verify UI information modals

Ensure fixed metric explanation modals are present in required sections.

Product: KPI, Bought Together, Added to Cart Together, Dwell Time. Category: Summary, Top table, Conversion, Navigation, Filters, Trends.

UI/UX Behavior Changes

  • Category overview/detail tabs now expose explicit loading, error, and empty states.
  • Product selection state is selectedProductId based and remains stable across catalog pagination.
  • Product catalog uses infinite append behavior (page-based accumulation).
  • Export flow is independent from dropdown visibility and catalog fetch timing.
  • Information modals are keyboard accessible (open/close, ESC close, focus trap, aria labeling).

Common Migration Failures

400 validation error on product analytics query

Cause: productItemCode is still being sent.

Fix: Switch query identity to productId (UUID).

Frontend cannot load product picker

Cause: UI still calls /api/v1/sites/:siteId/products.

Fix: Use /api/v1/analytics/product/:siteId/catalog with ANALYTICS_VIEW permission.

Currency displayed incorrectly

Cause: Client-side hardcoded currency formatter.

Fix: Format revenue with response currency only.

Associations data mismatch

Cause: Client is still splitting purchase/cart on removed routes.

Fix: Use merged associations endpoint with source and mode.

Release Checklist

  • No consumer calls removed product analytics v1 endpoints.Required
  • All product analytics drilldowns send productId UUID.Required
  • Merged associations endpoint is used for both purchase and cart analysis.Required
  • Category conversion revenue uses response revenueByCurrency[] rows.Required
  • Product top revenue uses response row currency field.Required
  • Required information modals are present and keyboard accessible.Required
  • Product analytics + category analytics Playwright flows pass in CI.Required