@loamly/tracker 2.0.2 → 2.1.1

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
@@ -30,7 +30,7 @@ Combined with [@loamly/edge](../edge/) for server-side detection, you get **75-8
30
30
  ```html
31
31
  <script src="https://cdn.jsdelivr.net/npm/@loamly/tracker@2/dist/loamly.iife.min.global.js"></script>
32
32
  <script>
33
- Loamly.init({ apiKey: 'your-api-key' });
33
+ Loamly.init({ apiKey: 'your-api-key', workspaceId: 'your-workspace-uuid' });
34
34
  </script>
35
35
  ```
36
36
 
@@ -43,7 +43,7 @@ npm install @loamly/tracker
43
43
  ```typescript
44
44
  import { loamly } from '@loamly/tracker';
45
45
 
46
- loamly.init({ apiKey: 'your-api-key' });
46
+ loamly.init({ apiKey: 'your-api-key', workspaceId: 'your-workspace-uuid' });
47
47
  ```
48
48
 
49
49
  ## Features
@@ -102,7 +102,8 @@ Initialize the tracker with configuration.
102
102
 
103
103
  ```typescript
104
104
  loamly.init({
105
- apiKey: 'your-api-key', // Required
105
+ apiKey: 'your-api-key', // Required
106
+ workspaceId: 'your-workspace-uuid', // Required for public tracker keys
106
107
  apiHost: 'https://app.loamly.ai', // Optional: custom host
107
108
  debug: true, // Optional: enable console logging
108
109
  disableAutoPageview: false, // Optional: disable auto pageview
@@ -110,6 +111,29 @@ loamly.init({
110
111
  });
111
112
  ```
112
113
 
114
+ ### Lightweight Mode
115
+
116
+ Disable specific features to reduce CPU/memory overhead:
117
+
118
+ ```typescript
119
+ loamly.init({
120
+ apiKey: 'your-api-key',
121
+ features: {
122
+ scroll: true, // Scroll depth tracking (default: true)
123
+ time: true, // Time on page tracking (default: true)
124
+ forms: true, // Form interaction tracking (default: true)
125
+ spa: true, // SPA navigation support (default: true)
126
+ behavioralML: false, // Behavioral ML classification (default: true) - saves ~2KB CPU
127
+ focusBlur: true, // Focus/blur paste detection (default: true)
128
+ agentic: false, // Agentic browser detection (default: true) - saves ~1.5KB CPU
129
+ eventQueue: true, // Event queue with retry (default: true)
130
+ ping: false, // Heartbeat ping service (default: false - opt-in)
131
+ }
132
+ });
133
+ ```
134
+
135
+ **Note:** All features are included in the bundle (~11KB gzipped). The `features` config only affects runtime initialization, not download size.
136
+
113
137
  ### `track(eventName, options?)`
114
138
 
115
139
  Track a custom event.