humanbehavior-js 0.4.11 → 0.4.13
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/canvas-recording-demo.html +143 -0
- package/dist/cjs/angular/index.cjs +23 -7
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +12 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +20 -12
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +20 -12
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +14 -4
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +19 -3
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/esm/angular/index.js +23 -7
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +12 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +20 -12
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +20 -12
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +14 -4
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +19 -3
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/angular/index.d.ts +21 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/index.d.ts +4 -0
- package/dist/types/remix/index.d.ts +4 -0
- package/dist/types/svelte/index.d.ts +9 -1
- package/dist/types/vue/index.d.ts +5 -0
- package/package.json +1 -1
- package/readme.md +20 -1
- package/src/angular/index.ts +31 -6
- package/src/react/index.tsx +12 -13
- package/src/svelte/index.ts +8 -2
- package/src/tracker.ts +14 -2
- package/src/vue/index.ts +12 -1
|
@@ -36,6 +36,7 @@ declare class HumanBehaviorTracker {
|
|
|
36
36
|
private sessionStartTime;
|
|
37
37
|
private rrwebRecord;
|
|
38
38
|
private fullSnapshotTimeout;
|
|
39
|
+
private recordCanvas;
|
|
39
40
|
/**
|
|
40
41
|
* Initialize the HumanBehavior tracker
|
|
41
42
|
* This is the main entry point - call this once per page
|
|
@@ -46,6 +47,7 @@ declare class HumanBehaviorTracker {
|
|
|
46
47
|
redactFields?: string[];
|
|
47
48
|
enableAutomaticTracking?: boolean;
|
|
48
49
|
suppressConsoleErrors?: boolean;
|
|
50
|
+
recordCanvas?: boolean;
|
|
49
51
|
automaticTrackingOptions?: {
|
|
50
52
|
trackButtons?: boolean;
|
|
51
53
|
trackLinks?: boolean;
|
|
@@ -220,6 +222,11 @@ declare class HumanBehaviorTracker {
|
|
|
220
222
|
declare class HumanBehaviorModule {
|
|
221
223
|
static forRoot(config: {
|
|
222
224
|
apiKey: string;
|
|
225
|
+
ingestionUrl?: string;
|
|
226
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
227
|
+
redactFields?: string[];
|
|
228
|
+
suppressConsoleErrors?: boolean;
|
|
229
|
+
recordCanvas?: boolean;
|
|
223
230
|
}): {
|
|
224
231
|
ngModule: typeof HumanBehaviorModule;
|
|
225
232
|
providers: ({
|
|
@@ -237,12 +244,24 @@ declare class HumanBehaviorModule {
|
|
|
237
244
|
}
|
|
238
245
|
declare class HumanBehaviorService {
|
|
239
246
|
private tracker;
|
|
240
|
-
constructor(apiKey: string
|
|
247
|
+
constructor(apiKey: string, options?: {
|
|
248
|
+
ingestionUrl?: string;
|
|
249
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
250
|
+
redactFields?: string[];
|
|
251
|
+
suppressConsoleErrors?: boolean;
|
|
252
|
+
recordCanvas?: boolean;
|
|
253
|
+
});
|
|
241
254
|
identifyUser(userProperties: Record<string, any>): Promise<string>;
|
|
242
255
|
getSessionId(): string;
|
|
243
256
|
setRedactedFields(fields: string[]): void;
|
|
244
257
|
getRedactedFields(): string[];
|
|
245
258
|
}
|
|
246
|
-
declare function initializeHumanBehavior(apiKey: string
|
|
259
|
+
declare function initializeHumanBehavior(apiKey: string, options?: {
|
|
260
|
+
ingestionUrl?: string;
|
|
261
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
262
|
+
redactFields?: string[];
|
|
263
|
+
suppressConsoleErrors?: boolean;
|
|
264
|
+
recordCanvas?: boolean;
|
|
265
|
+
}): HumanBehaviorTracker;
|
|
247
266
|
|
|
248
267
|
export { HumanBehaviorModule, HumanBehaviorService, initializeHumanBehavior };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ declare class HumanBehaviorTracker {
|
|
|
126
126
|
private sessionStartTime;
|
|
127
127
|
private rrwebRecord;
|
|
128
128
|
private fullSnapshotTimeout;
|
|
129
|
+
private recordCanvas;
|
|
129
130
|
/**
|
|
130
131
|
* Initialize the HumanBehavior tracker
|
|
131
132
|
* This is the main entry point - call this once per page
|
|
@@ -136,6 +137,7 @@ declare class HumanBehaviorTracker {
|
|
|
136
137
|
redactFields?: string[];
|
|
137
138
|
enableAutomaticTracking?: boolean;
|
|
138
139
|
suppressConsoleErrors?: boolean;
|
|
140
|
+
recordCanvas?: boolean;
|
|
139
141
|
automaticTrackingOptions?: {
|
|
140
142
|
trackButtons?: boolean;
|
|
141
143
|
trackLinks?: boolean;
|
|
@@ -38,6 +38,7 @@ declare class HumanBehaviorTracker {
|
|
|
38
38
|
private sessionStartTime;
|
|
39
39
|
private rrwebRecord;
|
|
40
40
|
private fullSnapshotTimeout;
|
|
41
|
+
private recordCanvas;
|
|
41
42
|
/**
|
|
42
43
|
* Initialize the HumanBehavior tracker
|
|
43
44
|
* This is the main entry point - call this once per page
|
|
@@ -48,6 +49,7 @@ declare class HumanBehaviorTracker {
|
|
|
48
49
|
redactFields?: string[];
|
|
49
50
|
enableAutomaticTracking?: boolean;
|
|
50
51
|
suppressConsoleErrors?: boolean;
|
|
52
|
+
recordCanvas?: boolean;
|
|
51
53
|
automaticTrackingOptions?: {
|
|
52
54
|
trackButtons?: boolean;
|
|
53
55
|
trackLinks?: boolean;
|
|
@@ -227,6 +229,8 @@ interface HumanBehaviorProviderProps {
|
|
|
227
229
|
ingestionUrl?: string;
|
|
228
230
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
229
231
|
redactFields?: string[];
|
|
232
|
+
suppressConsoleErrors?: boolean;
|
|
233
|
+
recordCanvas?: boolean;
|
|
230
234
|
};
|
|
231
235
|
}
|
|
232
236
|
declare const HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => React.JSX.Element;
|
|
@@ -39,6 +39,7 @@ declare class HumanBehaviorTracker {
|
|
|
39
39
|
private sessionStartTime;
|
|
40
40
|
private rrwebRecord;
|
|
41
41
|
private fullSnapshotTimeout;
|
|
42
|
+
private recordCanvas;
|
|
42
43
|
/**
|
|
43
44
|
* Initialize the HumanBehavior tracker
|
|
44
45
|
* This is the main entry point - call this once per page
|
|
@@ -49,6 +50,7 @@ declare class HumanBehaviorTracker {
|
|
|
49
50
|
redactFields?: string[];
|
|
50
51
|
enableAutomaticTracking?: boolean;
|
|
51
52
|
suppressConsoleErrors?: boolean;
|
|
53
|
+
recordCanvas?: boolean;
|
|
52
54
|
automaticTrackingOptions?: {
|
|
53
55
|
trackButtons?: boolean;
|
|
54
56
|
trackLinks?: boolean;
|
|
@@ -228,6 +230,8 @@ interface HumanBehaviorProviderProps {
|
|
|
228
230
|
ingestionUrl?: string;
|
|
229
231
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
230
232
|
redactFields?: string[];
|
|
233
|
+
suppressConsoleErrors?: boolean;
|
|
234
|
+
recordCanvas?: boolean;
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
237
|
declare const HumanBehaviorProvider: ({ apiKey, client, children, options }: HumanBehaviorProviderProps) => React.JSX.Element;
|
|
@@ -36,6 +36,7 @@ declare class HumanBehaviorTracker {
|
|
|
36
36
|
private sessionStartTime;
|
|
37
37
|
private rrwebRecord;
|
|
38
38
|
private fullSnapshotTimeout;
|
|
39
|
+
private recordCanvas;
|
|
39
40
|
/**
|
|
40
41
|
* Initialize the HumanBehavior tracker
|
|
41
42
|
* This is the main entry point - call this once per page
|
|
@@ -46,6 +47,7 @@ declare class HumanBehaviorTracker {
|
|
|
46
47
|
redactFields?: string[];
|
|
47
48
|
enableAutomaticTracking?: boolean;
|
|
48
49
|
suppressConsoleErrors?: boolean;
|
|
50
|
+
recordCanvas?: boolean;
|
|
49
51
|
automaticTrackingOptions?: {
|
|
50
52
|
trackButtons?: boolean;
|
|
51
53
|
trackLinks?: boolean;
|
|
@@ -218,7 +220,13 @@ declare class HumanBehaviorTracker {
|
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
declare const humanBehaviorStore: {
|
|
221
|
-
init: (apiKey: string
|
|
223
|
+
init: (apiKey: string, options?: {
|
|
224
|
+
ingestionUrl?: string;
|
|
225
|
+
logLevel?: "none" | "error" | "warn" | "info" | "debug";
|
|
226
|
+
redactFields?: string[];
|
|
227
|
+
suppressConsoleErrors?: boolean;
|
|
228
|
+
recordCanvas?: boolean;
|
|
229
|
+
}) => HumanBehaviorTracker;
|
|
222
230
|
};
|
|
223
231
|
|
|
224
232
|
export { humanBehaviorStore };
|
|
@@ -2,6 +2,11 @@ import { App } from 'vue';
|
|
|
2
2
|
|
|
3
3
|
interface HumanBehaviorPluginOptions {
|
|
4
4
|
apiKey: string;
|
|
5
|
+
ingestionUrl?: string;
|
|
6
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
7
|
+
redactFields?: string[];
|
|
8
|
+
suppressConsoleErrors?: boolean;
|
|
9
|
+
recordCanvas?: boolean;
|
|
5
10
|
}
|
|
6
11
|
declare const HumanBehaviorPlugin: {
|
|
7
12
|
install: (app: App, options: HumanBehaviorPluginOptions) => void;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,7 +38,8 @@ For the best session continuity experience, use the SPA approach:
|
|
|
38
38
|
const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
39
39
|
logLevel: 'warn', // Reduce console noise
|
|
40
40
|
redactFields: ['password', 'credit_card'],
|
|
41
|
-
suppressConsoleErrors: true // Suppress common rrweb errors (default)
|
|
41
|
+
suppressConsoleErrors: true, // Suppress common rrweb errors (default)
|
|
42
|
+
recordCanvas: false // Enable canvas recording with protection (default: false)
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
// Your SPA navigation logic here
|
|
@@ -86,6 +87,7 @@ const tracker = HumanBehaviorTracker.init(apiKey, options);
|
|
|
86
87
|
- `logLevel`: 'none' | 'error' | 'warn' | 'info' | 'debug'
|
|
87
88
|
- `redactFields`: Array of CSS selectors to redact
|
|
88
89
|
- `suppressConsoleErrors`: Boolean to suppress common rrweb errors (default: true)
|
|
90
|
+
- `recordCanvas`: Boolean to enable canvas recording with PostHog-style protection (default: false)
|
|
89
91
|
|
|
90
92
|
### Session Management
|
|
91
93
|
|
|
@@ -155,6 +157,23 @@ const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
|
155
157
|
- CORS policy violations
|
|
156
158
|
- Ad blocker interference warnings
|
|
157
159
|
|
|
160
|
+
### Canvas Recording
|
|
161
|
+
|
|
162
|
+
The SDK supports canvas recording with PostHog-style protection against overwhelming events:
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
// Enable canvas recording with protection
|
|
166
|
+
const tracker = HumanBehaviorTracker.init('your-api-key', {
|
|
167
|
+
recordCanvas: true // Enables canvas recording with 4 FPS throttle and 40% quality
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Protection Features:**
|
|
172
|
+
- **4 FPS Throttling**: Prevents canvas overwhelm (vs 60 FPS default)
|
|
173
|
+
- **40% Quality**: WebP format with compression
|
|
174
|
+
- **Opt-in Only**: Disabled by default for safety
|
|
175
|
+
- **Smart Sampling**: Only captures when canvas changes
|
|
176
|
+
|
|
158
177
|
## Session Continuity
|
|
159
178
|
|
|
160
179
|
The SDK automatically handles session continuity:
|
package/src/angular/index.ts
CHANGED
|
@@ -2,7 +2,14 @@ import { HumanBehaviorTracker } from '../index.js';
|
|
|
2
2
|
|
|
3
3
|
// Angular NgModule for legacy Angular applications
|
|
4
4
|
export class HumanBehaviorModule {
|
|
5
|
-
static forRoot(config: {
|
|
5
|
+
static forRoot(config: {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
ingestionUrl?: string;
|
|
8
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
9
|
+
redactFields?: string[];
|
|
10
|
+
suppressConsoleErrors?: boolean;
|
|
11
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
12
|
+
}) {
|
|
6
13
|
return {
|
|
7
14
|
ngModule: HumanBehaviorModule,
|
|
8
15
|
providers: [
|
|
@@ -13,7 +20,13 @@ export class HumanBehaviorModule {
|
|
|
13
20
|
{
|
|
14
21
|
provide: HumanBehaviorTracker,
|
|
15
22
|
useFactory: (apiKey: string) => {
|
|
16
|
-
return HumanBehaviorTracker.init(apiKey
|
|
23
|
+
return HumanBehaviorTracker.init(apiKey, {
|
|
24
|
+
ingestionUrl: config.ingestionUrl,
|
|
25
|
+
logLevel: config.logLevel,
|
|
26
|
+
redactFields: config.redactFields,
|
|
27
|
+
suppressConsoleErrors: config.suppressConsoleErrors,
|
|
28
|
+
recordCanvas: config.recordCanvas, // Pass canvas recording option
|
|
29
|
+
});
|
|
17
30
|
},
|
|
18
31
|
deps: ['HUMANBEHAVIOR_API_KEY']
|
|
19
32
|
}
|
|
@@ -26,8 +39,14 @@ export class HumanBehaviorModule {
|
|
|
26
39
|
export class HumanBehaviorService {
|
|
27
40
|
private tracker: HumanBehaviorTracker;
|
|
28
41
|
|
|
29
|
-
constructor(apiKey: string
|
|
30
|
-
|
|
42
|
+
constructor(apiKey: string, options?: {
|
|
43
|
+
ingestionUrl?: string;
|
|
44
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
45
|
+
redactFields?: string[];
|
|
46
|
+
suppressConsoleErrors?: boolean;
|
|
47
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
48
|
+
}) {
|
|
49
|
+
this.tracker = HumanBehaviorTracker.init(apiKey, options);
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
// Expose core tracker methods
|
|
@@ -49,6 +68,12 @@ export class HumanBehaviorService {
|
|
|
49
68
|
}
|
|
50
69
|
|
|
51
70
|
// Helper function for standalone Angular initialization
|
|
52
|
-
export function initializeHumanBehavior(apiKey: string
|
|
53
|
-
|
|
71
|
+
export function initializeHumanBehavior(apiKey: string, options?: {
|
|
72
|
+
ingestionUrl?: string;
|
|
73
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
74
|
+
redactFields?: string[];
|
|
75
|
+
suppressConsoleErrors?: boolean;
|
|
76
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
77
|
+
}): HumanBehaviorTracker {
|
|
78
|
+
return HumanBehaviorTracker.init(apiKey, options);
|
|
54
79
|
}
|
package/src/react/index.tsx
CHANGED
|
@@ -28,6 +28,8 @@ interface HumanBehaviorProviderProps {
|
|
|
28
28
|
ingestionUrl?: string;
|
|
29
29
|
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
30
30
|
redactFields?: string[];
|
|
31
|
+
suppressConsoleErrors?: boolean;
|
|
32
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -105,21 +107,18 @@ export const HumanBehaviorProvider = ({ apiKey, client, children, options }: Hum
|
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
// Create new tracker instance with the validated apiKey
|
|
109
|
-
const tracker =
|
|
110
|
-
apiKeyRef.current.trim()
|
|
110
|
+
// Create new tracker instance with the validated apiKey and options
|
|
111
|
+
const tracker = HumanBehaviorTracker.init(
|
|
112
|
+
apiKeyRef.current.trim(),
|
|
113
|
+
{
|
|
114
|
+
ingestionUrl: options?.ingestionUrl,
|
|
115
|
+
logLevel: options?.logLevel,
|
|
116
|
+
redactFields: options?.redactFields,
|
|
117
|
+
suppressConsoleErrors: options?.suppressConsoleErrors,
|
|
118
|
+
recordCanvas: options?.recordCanvas, // Pass canvas recording option
|
|
119
|
+
}
|
|
111
120
|
);
|
|
112
121
|
|
|
113
|
-
// ✅ APPLY LOGGING CONFIGURATION FROM OPTIONS
|
|
114
|
-
if (options?.logLevel) {
|
|
115
|
-
HumanBehaviorTracker.configureLogging({ level: options.logLevel });
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// ✅ APPLY REDACTION FIELDS FROM OPTIONS
|
|
119
|
-
if (options?.redactFields && options.redactFields.length > 0) {
|
|
120
|
-
tracker.setRedactedFields(options.redactFields);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
122
|
setHumanBehavior(tracker);
|
|
124
123
|
|
|
125
124
|
// Wait for initialization to complete
|
package/src/svelte/index.ts
CHANGED
|
@@ -2,7 +2,13 @@ import { HumanBehaviorTracker } from '../index.js';
|
|
|
2
2
|
|
|
3
3
|
// Create a Svelte store-like interface for HumanBehavior
|
|
4
4
|
export const humanBehaviorStore = {
|
|
5
|
-
init: (apiKey: string
|
|
6
|
-
|
|
5
|
+
init: (apiKey: string, options?: {
|
|
6
|
+
ingestionUrl?: string;
|
|
7
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
8
|
+
redactFields?: string[];
|
|
9
|
+
suppressConsoleErrors?: boolean;
|
|
10
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
11
|
+
}) => {
|
|
12
|
+
return HumanBehaviorTracker.init(apiKey, options);
|
|
7
13
|
}
|
|
8
14
|
};
|
package/src/tracker.ts
CHANGED
|
@@ -50,6 +50,7 @@ export class HumanBehaviorTracker {
|
|
|
50
50
|
private sessionStartTime: number = Date.now();
|
|
51
51
|
private rrwebRecord: any = null;
|
|
52
52
|
private fullSnapshotTimeout: number | null = null;
|
|
53
|
+
private recordCanvas: boolean = false; // Store canvas recording preference
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Initialize the HumanBehavior tracker
|
|
@@ -61,6 +62,7 @@ export class HumanBehaviorTracker {
|
|
|
61
62
|
redactFields?: string[];
|
|
62
63
|
enableAutomaticTracking?: boolean;
|
|
63
64
|
suppressConsoleErrors?: boolean; // New option to control error suppression
|
|
65
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
64
66
|
automaticTrackingOptions?: {
|
|
65
67
|
trackButtons?: boolean;
|
|
66
68
|
trackLinks?: boolean;
|
|
@@ -138,6 +140,9 @@ export class HumanBehaviorTracker {
|
|
|
138
140
|
// Create new tracker instance
|
|
139
141
|
const tracker = new HumanBehaviorTracker(apiKey, options?.ingestionUrl);
|
|
140
142
|
|
|
143
|
+
// Store canvas recording preference
|
|
144
|
+
tracker.recordCanvas = options?.recordCanvas ?? false;
|
|
145
|
+
|
|
141
146
|
// Set redacted fields if specified
|
|
142
147
|
if (options?.redactFields) {
|
|
143
148
|
tracker.setRedactedFields(options.redactFields);
|
|
@@ -839,9 +844,16 @@ export class HumanBehaviorTracker {
|
|
|
839
844
|
slimDOMOptions: {},
|
|
840
845
|
// ✅ ERROR SUPPRESSION SETTINGS - Disabled to prevent console noise
|
|
841
846
|
collectFonts: false, // Disable font collection to reduce errors
|
|
842
|
-
inlineStylesheet:
|
|
847
|
+
inlineStylesheet: true, // Keep styles for proper session replay
|
|
843
848
|
recordCrossOriginIframes: false, // Prevent cross-origin iframe errors
|
|
844
|
-
|
|
849
|
+
|
|
850
|
+
// ✅ CANVAS RECORDING - PostHog-style protection against overwhelm
|
|
851
|
+
recordCanvas: this.recordCanvas, // Opt-in only
|
|
852
|
+
sampling: this.recordCanvas ? { canvas: 4 } : undefined, // 4 FPS throttle
|
|
853
|
+
dataURLOptions: this.recordCanvas ? {
|
|
854
|
+
type: 'image/webp',
|
|
855
|
+
quality: 0.4
|
|
856
|
+
} : undefined, // WebP with 40% quality
|
|
845
857
|
|
|
846
858
|
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
847
859
|
// Rely on initial FullSnapshot + navigation-triggered ones only
|
package/src/vue/index.ts
CHANGED
|
@@ -3,11 +3,22 @@ import type { App } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
interface HumanBehaviorPluginOptions {
|
|
5
5
|
apiKey: string;
|
|
6
|
+
ingestionUrl?: string;
|
|
7
|
+
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
8
|
+
redactFields?: string[];
|
|
9
|
+
suppressConsoleErrors?: boolean;
|
|
10
|
+
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
export const HumanBehaviorPlugin = {
|
|
9
14
|
install: (app: App, options: HumanBehaviorPluginOptions) => {
|
|
10
|
-
const tracker = HumanBehaviorTracker.init(options.apiKey
|
|
15
|
+
const tracker = HumanBehaviorTracker.init(options.apiKey, {
|
|
16
|
+
ingestionUrl: options.ingestionUrl,
|
|
17
|
+
logLevel: options.logLevel,
|
|
18
|
+
redactFields: options.redactFields,
|
|
19
|
+
suppressConsoleErrors: options.suppressConsoleErrors,
|
|
20
|
+
recordCanvas: options.recordCanvas, // Pass canvas recording option
|
|
21
|
+
});
|
|
11
22
|
|
|
12
23
|
// Make tracker available globally
|
|
13
24
|
app.config.globalProperties.$humanBehavior = tracker;
|