Problem
Algolia's analytics and A/B testing team served the main search dashboard and the analytics pages of individual features such as Visual Merchandising Studio and Rules. Each page needed its own metrics at several aggregation levels. The old implementation computed related metrics on separate paths and tied each endpoint to one metric. Every new metric meant a new endpoint, repeated logic, more room for errors and slower queries, and the team became a development bottleneck.
Example from the article: click-through rate and no-click rate share most of their ingredients, but the old code calculated them in two separate paths.
Solution in brief
Put a semantic package between the search data and the analytics API. Describe every query as source, columns, transformations and aggregations, so related metrics reuse the same building blocks. Endpoints then take parameters that describe the metric, and they return the data shape of a UI component (time series, table) instead of one metric. Feature teams build on this platform themselves.
Questions this case answers
- How to serve many related metrics at several aggregation levels from one set of reusable definitions instead of one hard-coded data path per metric
- How to move ownership of metric logic from a single central team to many product teams without duplicating calculations
- How to add new product metrics without writing a new API endpoint and a new SQL path for each one?
- How to stop re-implementing shared logic (clicks, tracked searches) for related metrics such as click-through rate and no-click rate?
Tools and methods
- Semantic layer (semantic package) — a governed set of reusable query components in front of the search data
- Parameterized analytics API — endpoints that accept a description of the wanted metric instead of one endpoint per metric
- Events API — the channel through which customers send clicks and conversions, combined with search engine logs
Google or a one-time email code. No password.