Tag analytics provides aggregate metric views across product tags — enabling Creative and Ops teams to understand which design categories, themes, and product lines are performing. It builds on the tag classification system and the mart refresh pipeline.
Goal: Answer questions like “How are all iPhone-floral products performing?” or “Which tag category has the highest 30-day sales?”
The distribution endpoint returns how tags within a category are distributed across products — useful for understanding coverage (e.g., “80% of products have a season tag, but only 30% have a designer tag”).
sequenceDiagram
participant User as Staff user
participant API as Dashboard API
participant DB as PlanetScale
User->>API: POST /tag-analytics/performance
API->>DB: Query product + measurement.sales (R2) + product_tag
DB-->>API: Aggregated metrics
API-->>User: Tag performance metrics
User->>API: POST /tag-analytics/refresh
API->>DB: Rebuild tag performance aggregate
DB-->>API: Success
API-->>User: { success: true }