@productbet/tracker-core 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +86 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @productbet/tracker-core
2
+
3
+ Core behavioral analytics SDK for [ProductBet](https://productbet.io). Handles session recording, event tracking, user identification, and data ingestion.
4
+
5
+ > Most users should install **[@productbet/tracker-react](https://www.npmjs.com/package/@productbet/tracker-react)** or **[@productbet/tracker-next](https://www.npmjs.com/package/@productbet/tracker-next)** instead, which include this package automatically.
6
+
7
+ test2
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @productbet/tracker-core
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { ProductBetTracker } from "@productbet/tracker-core";
19
+
20
+ const tracker = ProductBetTracker.init("pb_live_xxxx", {
21
+ enableSessionRecording: true,
22
+ enableAutoTracking: true,
23
+ });
24
+
25
+ tracker.start();
26
+
27
+ // Identify a user
28
+ tracker.identify("user_123", { plan: "pro", company: "Acme" });
29
+
30
+ // Track a custom event
31
+ tracker.track("feature_used", { feature: "export", format: "csv" });
32
+
33
+ // Stop tracking
34
+ tracker.stop();
35
+ ```
36
+
37
+ ## Configuration
38
+
39
+ All options are optional.
40
+
41
+ | Option | Type | Default | Description |
42
+ | ------------------------ | --------------------- | ---------------------------------- | -------------------------------------------- |
43
+ | `ingestionUrl` | `string` | `"https://productbet.io/tracking"` | Ingestion endpoint URL |
44
+ | `enableSessionRecording` | `boolean` | `false` | Enable rrweb session replay |
45
+ | `enableAutoTracking` | `boolean` | `true` | Auto-track clicks, forms, navigation, scroll |
46
+ | `enableConsoleTracking` | `boolean` | `true` | Capture console errors and warnings |
47
+ | `enableNetworkTracking` | `boolean` | `true` | Capture failed network requests |
48
+ | `recordCanvas` | `boolean` | `false` | Include canvas elements in recordings |
49
+ | `maxQueueSize` | `number` | `1000` | Max events queued before flush |
50
+ | `flushIntervalMs` | `number` | `3000` | How often events are sent (ms) |
51
+ | `sessionTimeoutMs` | `number` | `1800000` | Session timeout (30 min default) |
52
+ | `debug` | `boolean` | `false` | Enable debug logging |
53
+ | `redaction` | `RedactionOptions` | `{ mode: "privacy-first" }` | PII redaction settings |
54
+ | `autoTrackingOptions` | `AutoTrackingOptions` | See below | Fine-tune auto-tracking |
55
+
56
+ ### Auto-tracking options
57
+
58
+ | Option | Type | Default |
59
+ | ------------------ | --------- | ------- |
60
+ | `trackClicks` | `boolean` | `true` |
61
+ | `trackForms` | `boolean` | `true` |
62
+ | `trackNavigation` | `boolean` | `true` |
63
+ | `trackScrollDepth` | `boolean` | `true` |
64
+ | `detectRageClicks` | `boolean` | `true` |
65
+ | `detectDeadClicks` | `boolean` | `true` |
66
+ | `includeText` | `boolean` | `true` |
67
+ | `includeClasses` | `boolean` | `true` |
68
+
69
+ ### Redaction
70
+
71
+ By default, the SDK runs in `privacy-first` mode where all text input values are redacted. Use `unredactFields` to allowlist specific fields:
72
+
73
+ ```ts
74
+ ProductBetTracker.init("pb_live_xxxx", {
75
+ redaction: {
76
+ mode: "privacy-first",
77
+ unredactFields: ["search", "email"],
78
+ },
79
+ });
80
+ ```
81
+
82
+ Set `mode: "visibility-first"` to capture all field values by default.
83
+
84
+ ## License
85
+
86
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productbet/tracker-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Core behavioral analytics SDK for ProductBet - session recording, event tracking, and user identification",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",