@litemetrics/node 0.1.2 → 0.2.0

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
@@ -69,7 +69,7 @@ const collector = await createCollector({
69
69
  - **Bot Filtering** - Automatically drops events from known bots and crawlers
70
70
  - **GeoIP Enrichment** - Resolves country/city from IP using MaxMind GeoLite2
71
71
  - **User-Agent Parsing** - Extracts browser, OS, and device type
72
- - **Hostname Filtering** - Only count events from allowed hostnames per site
72
+ - **Hostname Filtering** - Only count events from allowed hostnames per site (matched against request Origin/Referer)
73
73
  - **Query API** - Built-in metrics for pages, events, conversions, and behavioral insights
74
74
  - **Segmentation Filters** - Filter any metric/time series by geo, device, UTM, referrer, or event metadata
75
75
  - **Time Series** - Hourly/daily/weekly/monthly breakdowns
@@ -87,6 +87,22 @@ await collector.track('site-id', 'Purchase', { amount: 99 }, { userId: 'user-123
87
87
  await collector.identify('site-id', 'user-123', { plan: 'pro' });
88
88
  ```
89
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
+
90
106
  ## Metrics
91
107
 
92
108
  | Metric | Description |