Analytics
The Analytics app provides a comprehensive dashboard for tracking link performance across the platform. It aggregates click data, unique visitors, geographic distribution, device types, and referral sources for all of a user’s links.
Key features
Section titled “Key features”- Summary stats showing total clicks, unique visitors, top country, and top referrer
- Time series table displaying daily click and visitor data for the last 30 days
- Sub-page navigation for detailed breakdowns by geography, device, referrer, and raw click logs
- Configurable settings for analytics preferences
Page structure
Section titled “Page structure”| Route | Purpose |
|---|---|
/business/apps/analytics | Main dashboard with stats and 30-day time series |
/business/apps/analytics/clicks | Detailed click log |
/business/apps/analytics/geo | Geographic breakdown of traffic |
/business/apps/analytics/devices | Device and browser breakdown |
/business/apps/analytics/referrers | Referral source breakdown |
/business/apps/analytics/settings | Analytics configuration |
Data model overview
Section titled “Data model overview”The server load function calls two service functions from $lib/apps/analytics/services/index.js:
| Function | Parameters | Description |
|---|---|---|
getStats(userId) | User ID | Returns aggregate stats: total_clicks, unique_visitors, top_country, top_referrer |
getTimeSeries(userId, start, end, range, granularity) | User ID, date range, granularity | Returns time series data; defaults to 30-day range with daily granularity |
Each time series data point contains: date, clicks, and unique_visitors.
Key components
Section titled “Key components”The dashboard is organized into three sections:
- Stats grid — four
Cardcomponents in a responsive 4-column layout, each with an icon and metric label - Quick navigation grid — five cards linking to Click Log, Geography, Devices, Referrers, and Settings, each with a colored icon and title
- Time series table — a full-width HTML table with Date, Clicks, and Unique Visitors columns, rendered inside a
Card
Notable integrations
Section titled “Notable integrations”- Cross-app data — analytics data spans shortlinks, biolinks, and other link apps, providing a unified view
- Service-layer abstraction — the
getStatsandgetTimeSeriesfunctions encapsulate all database queries, making the load function a simple two-call parallel fetch - Locale formatting — numbers use
toLocaleString()for readable display