@litemetrics/node 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,7 +70,8 @@ const collector = await createCollector({
70
70
  - **GeoIP Enrichment** - Resolves country/city from IP using MaxMind GeoLite2
71
71
  - **User-Agent Parsing** - Extracts browser, OS, and device type
72
72
  - **Hostname Filtering** - Only count events from allowed hostnames per site
73
- - **Query API** - 12 built-in metrics (pageviews, visitors, sessions, top pages, etc.)
73
+ - **Query API** - Built-in metrics for pages, events, conversions, and behavioral insights
74
+ - **Segmentation Filters** - Filter any metric/time series by geo, device, UTM, referrer, or event metadata
74
75
  - **Time Series** - Hourly/daily/weekly/monthly breakdowns
75
76
  - **Retention Analysis** - Weekly cohort retention
76
77
  - **Site Management** - Multi-tenant CRUD with secret key auth
@@ -86,6 +87,22 @@ await collector.track('site-id', 'Purchase', { amount: 99 }, { userId: 'user-123
86
87
  await collector.identify('site-id', 'user-123', { plan: 'pro' });
87
88
  ```
88
89
 
90
+ ## Identity Merging
91
+
92
+ Litemetrics automatically links anonymous visitors to identified users. After a
93
+ user is identified, subsequent events are merged across all linked visitor IDs.
94
+ `GET /api/users/:identifier` accepts either a `visitorId` or a `userId` and
95
+ returns a merged profile when available.
96
+
97
+ ### Backfill (one-time)
98
+
99
+ If you already have identify events, run the backfill script once to populate
100
+ the identity map:
101
+
102
+ ```bash
103
+ bun packages/node/src/backfill-identity.ts --adapter clickhouse --url http://localhost:8123
104
+ ```
105
+
89
106
  ## Metrics
90
107
 
91
108
  | Metric | Description |
@@ -94,11 +111,18 @@ await collector.identify('site-id', 'user-123', { plan: 'pro' });
94
111
  | `visitors` | Unique visitors |
95
112
  | `sessions` | Unique sessions |
96
113
  | `events` | Custom events count |
114
+ | `conversions` | Conversion events count |
97
115
  | `top_pages` | Most visited pages |
98
116
  | `top_referrers` | Top traffic sources |
99
117
  | `top_countries` | Visitors by country |
100
118
  | `top_cities` | Visitors by city |
101
119
  | `top_events` | Most common custom events |
120
+ | `top_conversions` | Most common conversion events |
121
+ | `top_exit_pages` | Last page in session |
122
+ | `top_transitions` | Page-to-page transitions |
123
+ | `top_scroll_pages` | Pages with most scroll depth events |
124
+ | `top_button_clicks` | Most clicked buttons (auto events) |
125
+ | `top_link_targets` | Most clicked link targets |
102
126
  | `top_browsers` | Browser breakdown |
103
127
  | `top_os` | OS breakdown |
104
128
  | `top_devices` | Device type breakdown |