Key Features
- Flexible Event Tracking: Track any type of event with customizable counts and values
- Time-based Aggregation: Automatically aggregate events by hour, day, week, month, or custom time units
- Entity-based Organization: Group metrics by entities (users, products, etc.)
- Real-time Updates: Increment metrics in real-time or batch update historical data
- Timeline Views: Access aggregated data for any time period
Core Concepts
Metric Address
Every metric is identified by three components:- Noun: The entity type being tracked (e.g., “product”, “user”)
- Action: The action being measured (e.g., “purchase”, “view”, “click”)
- Entity: The specific entity ID (e.g., product ID, user ID)
Metric Structure
Metrics are stored in a hierarchical structure:Trackable Events
Events contain:- time: When the event occurred (Firestore Timestamp)
- count: Number of occurrences (optional, defaults to 1)
- value: Numerical value associated with the event (optional, defaults to 1)
Timezone Support
Metrics support timezone-aware aggregation for accurate daily, weekly, and monthly boundaries:- Configure timezone per metric using IANA timezone identifiers
- Events are aggregated based on local time boundaries
- Perfect for multi-region applications with location-specific reporting
Quick Start
Configure Metrics
First, configure your metric with time units and timezone:Increment a Metric
Track a single event in real-time:Batch Update Metrics
Update historical data or import events:Next Steps
- Increment Metrics - Learn about real-time metric tracking
- Update Metrics - Batch update and import historical data
- Types Reference - Detailed type definitions
- Utilities - Helper functions and advanced usage