@zaplier/sdk 1.0.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/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/index.cjs +11092 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1204 -0
- package/dist/index.esm.js +11059 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3517 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.js +11098 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sdk.min.js +7 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/modules/anti-adblock.d.ts +108 -0
- package/dist/src/modules/anti-adblock.d.ts.map +1 -0
- package/dist/src/modules/bot-detection.d.ts +15 -0
- package/dist/src/modules/bot-detection.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/accessibility.d.ts +155 -0
- package/dist/src/modules/fingerprint/accessibility.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/audio.d.ts +16 -0
- package/dist/src/modules/fingerprint/audio.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/browser-apis.d.ts +108 -0
- package/dist/src/modules/fingerprint/browser-apis.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/browser.d.ts +14 -0
- package/dist/src/modules/fingerprint/browser.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/canvas.d.ts +14 -0
- package/dist/src/modules/fingerprint/canvas.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/confidence.d.ts +89 -0
- package/dist/src/modules/fingerprint/confidence.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/datetime-locale.d.ts +76 -0
- package/dist/src/modules/fingerprint/datetime-locale.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/device-signals.d.ts +29 -0
- package/dist/src/modules/fingerprint/device-signals.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/dom-blockers.d.ts +56 -0
- package/dist/src/modules/fingerprint/dom-blockers.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/font-preferences.d.ts +55 -0
- package/dist/src/modules/fingerprint/font-preferences.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/fonts-enhanced.d.ts +43 -0
- package/dist/src/modules/fingerprint/fonts-enhanced.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/fonts.d.ts +14 -0
- package/dist/src/modules/fingerprint/fonts.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/hardware.d.ts +40 -0
- package/dist/src/modules/fingerprint/hardware.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/hashing.d.ts +28 -0
- package/dist/src/modules/fingerprint/hashing.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/incognito.d.ts +6 -0
- package/dist/src/modules/fingerprint/incognito.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/math-enhanced.d.ts +70 -0
- package/dist/src/modules/fingerprint/math-enhanced.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/math.d.ts +32 -0
- package/dist/src/modules/fingerprint/math.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/plugins-enhanced.d.ts +97 -0
- package/dist/src/modules/fingerprint/plugins-enhanced.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/screen.d.ts +15 -0
- package/dist/src/modules/fingerprint/screen.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/storage.d.ts +45 -0
- package/dist/src/modules/fingerprint/storage.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/system.d.ts +40 -0
- package/dist/src/modules/fingerprint/system.d.ts.map +1 -0
- package/dist/src/modules/fingerprint/webgl.d.ts +15 -0
- package/dist/src/modules/fingerprint/webgl.d.ts.map +1 -0
- package/dist/src/modules/fingerprint.d.ts +35 -0
- package/dist/src/modules/fingerprint.d.ts.map +1 -0
- package/dist/src/modules/global-interface.d.ts +141 -0
- package/dist/src/modules/global-interface.d.ts.map +1 -0
- package/dist/src/modules/heatmap.d.ts +140 -0
- package/dist/src/modules/heatmap.d.ts.map +1 -0
- package/dist/src/modules/incognito-detection.d.ts +23 -0
- package/dist/src/modules/incognito-detection.d.ts.map +1 -0
- package/dist/src/modules/session-replay.d.ts +132 -0
- package/dist/src/modules/session-replay.d.ts.map +1 -0
- package/dist/src/modules/user-agent.d.ts +35 -0
- package/dist/src/modules/user-agent.d.ts.map +1 -0
- package/dist/src/sdk.d.ts +227 -0
- package/dist/src/sdk.d.ts.map +1 -0
- package/dist/src/types/config.d.ts +44 -0
- package/dist/src/types/config.d.ts.map +1 -0
- package/dist/src/types/detection.d.ts +114 -0
- package/dist/src/types/detection.d.ts.map +1 -0
- package/dist/src/types/events.d.ts +174 -0
- package/dist/src/types/events.d.ts.map +1 -0
- package/dist/src/types/fingerprint.d.ts +157 -0
- package/dist/src/types/fingerprint.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +83 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/methods.d.ts +83 -0
- package/dist/src/types/methods.d.ts.map +1 -0
- package/dist/src/types/visitor.d.ts +90 -0
- package/dist/src/types/visitor.d.ts.map +1 -0
- package/dist/src/utils/browser.d.ts +79 -0
- package/dist/src/utils/browser.d.ts.map +1 -0
- package/dist/src/utils/lazy-loader.d.ts +60 -0
- package/dist/src/utils/lazy-loader.d.ts.map +1 -0
- package/dist/src/utils/webgl-cache.d.ts +43 -0
- package/dist/src/utils/webgl-cache.d.ts.map +1 -0
- package/package.json +82 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visitor-related types for SDK responses
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Visitor information returned by getVisitorInfo()
|
|
6
|
+
*/
|
|
7
|
+
interface VisitorInfo {
|
|
8
|
+
visitorId: string;
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
location: {
|
|
11
|
+
country?: string;
|
|
12
|
+
countryCode?: string;
|
|
13
|
+
city?: string;
|
|
14
|
+
};
|
|
15
|
+
device: {
|
|
16
|
+
browser?: string;
|
|
17
|
+
os?: string;
|
|
18
|
+
deviceType?: string;
|
|
19
|
+
userAgent?: string;
|
|
20
|
+
};
|
|
21
|
+
stats: {
|
|
22
|
+
visitCount: number;
|
|
23
|
+
firstSeenAt: string;
|
|
24
|
+
lastSeenAt: string;
|
|
25
|
+
identificationScore?: number;
|
|
26
|
+
};
|
|
27
|
+
signals?: {
|
|
28
|
+
smartSignals?: any;
|
|
29
|
+
tlsFingerprint?: string | null;
|
|
30
|
+
cookieFingerprint?: string | null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Visit history entry
|
|
35
|
+
*/
|
|
36
|
+
interface VisitHistoryEntry {
|
|
37
|
+
id: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
location: string | null;
|
|
40
|
+
country?: string | null;
|
|
41
|
+
countryCode?: string | null;
|
|
42
|
+
city?: string | null;
|
|
43
|
+
ip: string | null;
|
|
44
|
+
browser: string | null;
|
|
45
|
+
os: string | null;
|
|
46
|
+
deviceType: string | null;
|
|
47
|
+
isIncognito: boolean;
|
|
48
|
+
vpnDetected: boolean;
|
|
49
|
+
suspectScore: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Visitor history response
|
|
53
|
+
*/
|
|
54
|
+
interface VisitorHistory {
|
|
55
|
+
visitorId: string;
|
|
56
|
+
visits: VisitHistoryEntry[];
|
|
57
|
+
summary: {
|
|
58
|
+
totalVisits: number;
|
|
59
|
+
uniqueIPs: number;
|
|
60
|
+
uniqueLocations: number;
|
|
61
|
+
incognitoSessions: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* User data returned by getUserData()
|
|
66
|
+
*/
|
|
67
|
+
interface UserData {
|
|
68
|
+
sessionId: string;
|
|
69
|
+
visitorId?: string;
|
|
70
|
+
userId?: string;
|
|
71
|
+
location: {
|
|
72
|
+
city?: string;
|
|
73
|
+
country?: string;
|
|
74
|
+
coordinates?: {
|
|
75
|
+
lat: number;
|
|
76
|
+
lng: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
device: {
|
|
80
|
+
userAgent: string;
|
|
81
|
+
language: string;
|
|
82
|
+
screen: {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
journey: any[];
|
|
88
|
+
fingerprint?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* SDK Configuration Types
|
|
93
|
+
*
|
|
94
|
+
* 100% Cookieless tracking using fingerprinting only.
|
|
95
|
+
* No storage dependencies - fully GDPR/LGPD compliant.
|
|
96
|
+
*/
|
|
97
|
+
interface SDKConfig {
|
|
98
|
+
/** Workspace token (required) */
|
|
99
|
+
token: string;
|
|
100
|
+
/** Enable session replay recording (default: false) */
|
|
101
|
+
replay?: boolean;
|
|
102
|
+
/** Enable heatmap tracking (default: false) */
|
|
103
|
+
heatmap?: boolean;
|
|
104
|
+
/** Enable debug mode for development (default: false) */
|
|
105
|
+
debug?: boolean;
|
|
106
|
+
/** Allow tracking on localhost (default: false) */
|
|
107
|
+
allow_localhost?: boolean;
|
|
108
|
+
/** GDPR mode - limits invasive fingerprinting (default: false) */
|
|
109
|
+
gdprMode?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Internal configuration with optimized defaults
|
|
113
|
+
* These settings are not exposed to the user but can be referenced internally
|
|
114
|
+
*/
|
|
115
|
+
interface InternalConfig extends SDKConfig {
|
|
116
|
+
apiEndpoint: string;
|
|
117
|
+
retryEnabled: boolean;
|
|
118
|
+
maxRetries: number;
|
|
119
|
+
retryDelays: number[];
|
|
120
|
+
autoTrack: boolean;
|
|
121
|
+
dedupeEnabled: boolean;
|
|
122
|
+
fingerprintEnabled: boolean;
|
|
123
|
+
presenceTracking: boolean;
|
|
124
|
+
heartbeatInterval: number;
|
|
125
|
+
scrollTracking: boolean;
|
|
126
|
+
scrollDepthTracking: boolean;
|
|
127
|
+
gdprCompliant: boolean;
|
|
128
|
+
enhancedTracking: 'ask' | 'true' | 'false';
|
|
129
|
+
replaySampling: number;
|
|
130
|
+
replayMaskInputs: boolean;
|
|
131
|
+
}
|
|
132
|
+
type ConfigKey = keyof SDKConfig;
|
|
133
|
+
type InternalConfigKey = keyof InternalConfig;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Event and Tracking Types
|
|
137
|
+
*/
|
|
138
|
+
interface BaseEventData {
|
|
139
|
+
eventType: string;
|
|
140
|
+
eventName?: string;
|
|
141
|
+
customData?: Record<string, any>;
|
|
142
|
+
}
|
|
143
|
+
interface PageViewEvent extends BaseEventData {
|
|
144
|
+
eventType: 'page_view';
|
|
145
|
+
url?: string;
|
|
146
|
+
pageTitle?: string;
|
|
147
|
+
referrer?: string;
|
|
148
|
+
spaNavigation?: boolean;
|
|
149
|
+
navigationType?: 'manual' | 'spa' | 'direct';
|
|
150
|
+
}
|
|
151
|
+
interface CustomEvent extends BaseEventData {
|
|
152
|
+
eventType: 'custom';
|
|
153
|
+
eventName: string;
|
|
154
|
+
metadata?: Record<string, any>;
|
|
155
|
+
}
|
|
156
|
+
interface ConversionEvent extends BaseEventData {
|
|
157
|
+
eventType: 'conversion';
|
|
158
|
+
eventName: string;
|
|
159
|
+
revenue?: number;
|
|
160
|
+
currency?: string;
|
|
161
|
+
metadata?: Record<string, any>;
|
|
162
|
+
}
|
|
163
|
+
interface EcommerceEvent extends BaseEventData {
|
|
164
|
+
eventType: 'purchase' | 'add_to_cart' | 'view_content' | 'initiate_checkout';
|
|
165
|
+
productId?: string;
|
|
166
|
+
productName?: string;
|
|
167
|
+
price?: number;
|
|
168
|
+
quantity?: number;
|
|
169
|
+
revenue?: number;
|
|
170
|
+
currency?: string;
|
|
171
|
+
orderId?: string;
|
|
172
|
+
}
|
|
173
|
+
interface IdentifyEvent extends BaseEventData {
|
|
174
|
+
eventType: 'identify';
|
|
175
|
+
email?: string;
|
|
176
|
+
phone?: string;
|
|
177
|
+
userData?: Record<string, any>;
|
|
178
|
+
}
|
|
179
|
+
type EventData = PageViewEvent | CustomEvent | ConversionEvent | EcommerceEvent | IdentifyEvent;
|
|
180
|
+
/**
|
|
181
|
+
* Internal event payload sent to server
|
|
182
|
+
*/
|
|
183
|
+
interface EventPayload {
|
|
184
|
+
eventId: string;
|
|
185
|
+
eventType: string;
|
|
186
|
+
eventName?: string;
|
|
187
|
+
sessionId: string;
|
|
188
|
+
userId?: string;
|
|
189
|
+
timestamp: string;
|
|
190
|
+
url: string;
|
|
191
|
+
referrer?: string;
|
|
192
|
+
pageTitle?: string;
|
|
193
|
+
utmSource?: string;
|
|
194
|
+
utmMedium?: string;
|
|
195
|
+
utmCampaign?: string;
|
|
196
|
+
utmContent?: string;
|
|
197
|
+
utmTerm?: string;
|
|
198
|
+
fbclid?: string;
|
|
199
|
+
gclid?: string;
|
|
200
|
+
ttclid?: string;
|
|
201
|
+
fbp?: string;
|
|
202
|
+
fbc?: string;
|
|
203
|
+
userAgent: string;
|
|
204
|
+
screenWidth: number;
|
|
205
|
+
screenHeight: number;
|
|
206
|
+
viewportWidth: number;
|
|
207
|
+
viewportHeight: number;
|
|
208
|
+
fingerprint?: string;
|
|
209
|
+
fingerprintComponents?: FingerprintComponents;
|
|
210
|
+
botDetection?: BotDetectionResult$2;
|
|
211
|
+
incognitoDetection?: IncognitoDetectionResult$2;
|
|
212
|
+
gdprMode: boolean;
|
|
213
|
+
enhancedMode: boolean;
|
|
214
|
+
customData?: Record<string, any>;
|
|
215
|
+
revenue?: number;
|
|
216
|
+
currency?: string;
|
|
217
|
+
productId?: string;
|
|
218
|
+
productName?: string;
|
|
219
|
+
quantity?: number;
|
|
220
|
+
orderId?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Fingerprinting component results
|
|
224
|
+
*/
|
|
225
|
+
interface FingerprintComponents {
|
|
226
|
+
canvas?: string;
|
|
227
|
+
webgl?: {
|
|
228
|
+
vendor: string;
|
|
229
|
+
renderer: string;
|
|
230
|
+
version: string;
|
|
231
|
+
};
|
|
232
|
+
audio?: string;
|
|
233
|
+
fonts?: string[];
|
|
234
|
+
screen: {
|
|
235
|
+
width: number;
|
|
236
|
+
height: number;
|
|
237
|
+
colorDepth: number;
|
|
238
|
+
pixelRatio: number;
|
|
239
|
+
};
|
|
240
|
+
timezone: number;
|
|
241
|
+
language: string;
|
|
242
|
+
platform: string;
|
|
243
|
+
hardwareConcurrency?: number;
|
|
244
|
+
deviceMemory?: number;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Bot detection result
|
|
248
|
+
*/
|
|
249
|
+
interface BotDetectionResult$2 {
|
|
250
|
+
isBot: boolean;
|
|
251
|
+
confidence: number;
|
|
252
|
+
detectors: {
|
|
253
|
+
webDriver: {
|
|
254
|
+
detected: boolean;
|
|
255
|
+
confidence: number;
|
|
256
|
+
};
|
|
257
|
+
headlessBrowser: {
|
|
258
|
+
detected: boolean;
|
|
259
|
+
confidence: number;
|
|
260
|
+
};
|
|
261
|
+
domBlockers: {
|
|
262
|
+
detected: boolean;
|
|
263
|
+
confidence: number;
|
|
264
|
+
};
|
|
265
|
+
canvasInconsistency: {
|
|
266
|
+
detected: boolean;
|
|
267
|
+
confidence: number;
|
|
268
|
+
};
|
|
269
|
+
webglAnomaly: {
|
|
270
|
+
detected: boolean;
|
|
271
|
+
confidence: number;
|
|
272
|
+
};
|
|
273
|
+
missingLanguages: {
|
|
274
|
+
detected: boolean;
|
|
275
|
+
confidence: number;
|
|
276
|
+
};
|
|
277
|
+
inconsistentEval: {
|
|
278
|
+
detected: boolean;
|
|
279
|
+
confidence: number;
|
|
280
|
+
};
|
|
281
|
+
automationTools: {
|
|
282
|
+
detected: boolean;
|
|
283
|
+
confidence: number;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
userAgent?: {
|
|
287
|
+
suspicious: boolean;
|
|
288
|
+
patterns: string[];
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Incognito mode detection result
|
|
293
|
+
*/
|
|
294
|
+
interface IncognitoDetectionResult$2 {
|
|
295
|
+
isIncognito: boolean;
|
|
296
|
+
confidence: number;
|
|
297
|
+
detectionMethods: {
|
|
298
|
+
localStorage: boolean | null;
|
|
299
|
+
indexedDB: boolean | null;
|
|
300
|
+
sessionStorage: boolean | null;
|
|
301
|
+
openDatabase: boolean | null;
|
|
302
|
+
permissions: boolean | null;
|
|
303
|
+
quotaManagement: boolean | null;
|
|
304
|
+
filesystem: boolean | null;
|
|
305
|
+
cookiesEnabled: boolean | null;
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Method parameter types for SDK calls
|
|
311
|
+
*/
|
|
312
|
+
/**
|
|
313
|
+
* Parameters for trackPurchase()
|
|
314
|
+
*/
|
|
315
|
+
interface TrackPurchaseParams {
|
|
316
|
+
value?: number;
|
|
317
|
+
revenue?: number;
|
|
318
|
+
currency?: string;
|
|
319
|
+
quantity?: number;
|
|
320
|
+
productId?: string;
|
|
321
|
+
productName?: string;
|
|
322
|
+
orderId?: string;
|
|
323
|
+
customData?: Record<string, any>;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Parameters for trackAddToCart()
|
|
327
|
+
*/
|
|
328
|
+
interface TrackAddToCartParams {
|
|
329
|
+
productId?: string;
|
|
330
|
+
productName?: string;
|
|
331
|
+
price?: number;
|
|
332
|
+
quantity?: number;
|
|
333
|
+
customData?: Record<string, any>;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Parameters for trackViewContent()
|
|
337
|
+
*/
|
|
338
|
+
interface TrackViewContentParams {
|
|
339
|
+
productId?: string;
|
|
340
|
+
productName?: string;
|
|
341
|
+
category?: string;
|
|
342
|
+
customData?: Record<string, any>;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Parameters for trackInitiateCheckout()
|
|
346
|
+
*/
|
|
347
|
+
interface TrackInitiateCheckoutParams {
|
|
348
|
+
value?: number;
|
|
349
|
+
currency?: string;
|
|
350
|
+
numItems?: number;
|
|
351
|
+
customData?: Record<string, any>;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Parameters for trackConversion()
|
|
355
|
+
*/
|
|
356
|
+
interface TrackConversionParams {
|
|
357
|
+
eventName: string;
|
|
358
|
+
value?: number;
|
|
359
|
+
currency?: string;
|
|
360
|
+
metadata?: Record<string, any>;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Parameters for identify()
|
|
364
|
+
*/
|
|
365
|
+
interface IdentifyParams {
|
|
366
|
+
email?: string;
|
|
367
|
+
phone?: string;
|
|
368
|
+
[key: string]: any;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Parameters for trackCustomEvent()
|
|
372
|
+
*/
|
|
373
|
+
interface TrackCustomEventParams {
|
|
374
|
+
eventName: string;
|
|
375
|
+
metadata?: Record<string, any>;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Response from trackConversion()
|
|
379
|
+
*/
|
|
380
|
+
interface ConversionLikelihoodResponse {
|
|
381
|
+
score: number;
|
|
382
|
+
factors: string[];
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Response from getUserSegment()
|
|
386
|
+
*/
|
|
387
|
+
interface UserSegmentResponse {
|
|
388
|
+
type: "high_intent" | "medium_intent" | "exploring";
|
|
389
|
+
confidence: number;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Fingerprinting Types
|
|
394
|
+
* Based on FingerprintJS architecture with privacy-first approach
|
|
395
|
+
*/
|
|
396
|
+
/**
|
|
397
|
+
* Individual fingerprint component
|
|
398
|
+
*/
|
|
399
|
+
interface FingerprintComponent<T = any> {
|
|
400
|
+
value: T;
|
|
401
|
+
duration?: number;
|
|
402
|
+
error?: string;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Canvas fingerprinting result
|
|
406
|
+
*/
|
|
407
|
+
interface CanvasFingerprint {
|
|
408
|
+
text: string;
|
|
409
|
+
geometry: string;
|
|
410
|
+
winding: boolean;
|
|
411
|
+
isInconsistent?: boolean;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* WebGL fingerprinting result
|
|
415
|
+
*/
|
|
416
|
+
interface WebGLFingerprint {
|
|
417
|
+
vendor: string;
|
|
418
|
+
renderer: string;
|
|
419
|
+
version: string;
|
|
420
|
+
extensions: string[];
|
|
421
|
+
parameters: Record<string, any>;
|
|
422
|
+
shaderPrecision: {
|
|
423
|
+
vertex: string;
|
|
424
|
+
fragment: string;
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Audio fingerprinting result
|
|
429
|
+
*/
|
|
430
|
+
interface AudioFingerprint {
|
|
431
|
+
oscillator: string;
|
|
432
|
+
compressor: string;
|
|
433
|
+
sampleRate: number;
|
|
434
|
+
maxChannelCount: number;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Font detection result
|
|
438
|
+
*/
|
|
439
|
+
interface FontFingerprint {
|
|
440
|
+
available: string[];
|
|
441
|
+
method: "basic" | "advanced";
|
|
442
|
+
measurements?: Record<string, {
|
|
443
|
+
width: number;
|
|
444
|
+
height: number;
|
|
445
|
+
}>;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Screen and viewport information
|
|
449
|
+
*/
|
|
450
|
+
interface ScreenFingerprint {
|
|
451
|
+
width: number;
|
|
452
|
+
height: number;
|
|
453
|
+
colorDepth: number;
|
|
454
|
+
pixelRatio: number;
|
|
455
|
+
viewportWidth: number;
|
|
456
|
+
viewportHeight: number;
|
|
457
|
+
availableWidth: number;
|
|
458
|
+
availableHeight: number;
|
|
459
|
+
orientation?: {
|
|
460
|
+
angle: number;
|
|
461
|
+
type: string;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Browser and system information
|
|
466
|
+
*/
|
|
467
|
+
interface BrowserFingerprint {
|
|
468
|
+
language: string;
|
|
469
|
+
languages: string[];
|
|
470
|
+
timezone: string;
|
|
471
|
+
timezoneOffset: number;
|
|
472
|
+
platform: string;
|
|
473
|
+
userAgent: string;
|
|
474
|
+
hardwareConcurrency: number;
|
|
475
|
+
deviceMemory?: number;
|
|
476
|
+
cookieEnabled: boolean;
|
|
477
|
+
doNotTrack: string | null;
|
|
478
|
+
plugins: {
|
|
479
|
+
length: number;
|
|
480
|
+
names: string[];
|
|
481
|
+
};
|
|
482
|
+
touchSupport: {
|
|
483
|
+
maxTouchPoints: number;
|
|
484
|
+
touchEvent: boolean;
|
|
485
|
+
touchStart: boolean;
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Complete fingerprint data
|
|
490
|
+
*/
|
|
491
|
+
interface FingerprintData {
|
|
492
|
+
canvas?: FingerprintComponent<CanvasFingerprint>;
|
|
493
|
+
webgl?: FingerprintComponent<WebGLFingerprint>;
|
|
494
|
+
audio?: FingerprintComponent<AudioFingerprint>;
|
|
495
|
+
fonts?: FingerprintComponent<FontFingerprint>;
|
|
496
|
+
screen: FingerprintComponent<ScreenFingerprint>;
|
|
497
|
+
browser: FingerprintComponent<BrowserFingerprint>;
|
|
498
|
+
incognitoDetection?: {
|
|
499
|
+
isIncognito: boolean;
|
|
500
|
+
confidence: number;
|
|
501
|
+
detectionMethods: string[];
|
|
502
|
+
detectionTimestamp?: number;
|
|
503
|
+
sdkVersion?: string;
|
|
504
|
+
details?: {
|
|
505
|
+
localStorage?: boolean;
|
|
506
|
+
sessionStorage?: boolean;
|
|
507
|
+
indexedDB?: boolean;
|
|
508
|
+
cookiesEnabled?: boolean;
|
|
509
|
+
quota?: number | null;
|
|
510
|
+
permissions?: any;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
hash: string;
|
|
514
|
+
stableCoreHash: string;
|
|
515
|
+
stableCoreVector?: Record<string, any>;
|
|
516
|
+
collectionTime: number;
|
|
517
|
+
gdprMode: boolean;
|
|
518
|
+
components: string[];
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Fingerprint collection options
|
|
522
|
+
*/
|
|
523
|
+
interface FingerprintOptions {
|
|
524
|
+
gdprMode?: boolean;
|
|
525
|
+
includeInvasive?: boolean;
|
|
526
|
+
timeout?: number;
|
|
527
|
+
debug?: boolean;
|
|
528
|
+
excludeComponents?: FingerprintComponentType[];
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Available fingerprint component types
|
|
532
|
+
*/
|
|
533
|
+
type FingerprintComponentType = "canvas" | "webgl" | "audio" | "fonts" | "screen" | "browser" | "incognito" | "hardware" | "system" | "storage" | "math" | "domBlockers" | "accessibility" | "browserApis" | "pluginsEnhanced" | "fontPreferences" | "dateTimeLocale" | "enhancedFonts" | "mathFingerprint" | "accessibilityEnhanced";
|
|
534
|
+
/**
|
|
535
|
+
* Fingerprint collection result
|
|
536
|
+
*/
|
|
537
|
+
interface FingerprintResult {
|
|
538
|
+
success: boolean;
|
|
539
|
+
data?: FingerprintData;
|
|
540
|
+
error?: string;
|
|
541
|
+
collectedComponents: FingerprintComponentType[];
|
|
542
|
+
failedComponents: {
|
|
543
|
+
component: FingerprintComponentType;
|
|
544
|
+
error: string;
|
|
545
|
+
}[];
|
|
546
|
+
confidence?: any;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
interface BotDetectionResult$1 {
|
|
550
|
+
isBot: boolean;
|
|
551
|
+
confidence: number;
|
|
552
|
+
riskLevel: "low" | "medium" | "high";
|
|
553
|
+
}
|
|
554
|
+
interface IncognitoDetectionResult$1 {
|
|
555
|
+
isIncognito: boolean;
|
|
556
|
+
confidence: number;
|
|
557
|
+
detectionMethods: string[];
|
|
558
|
+
}
|
|
559
|
+
interface UserAgentAnalysis$1 {
|
|
560
|
+
browser: string;
|
|
561
|
+
version: string;
|
|
562
|
+
engine: string;
|
|
563
|
+
os: string;
|
|
564
|
+
device: string;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Main SDK interface
|
|
568
|
+
*/
|
|
569
|
+
interface ZaplierSDK$1 {
|
|
570
|
+
track(eventType: string, eventData?: Record<string, any>): void;
|
|
571
|
+
trackCustomEvent(eventName: string, metadata?: Record<string, any>): boolean;
|
|
572
|
+
trackConversion(eventName: string, value?: number, currency?: string, metadata?: Record<string, any>): boolean;
|
|
573
|
+
trackPageView(data?: Partial<PageViewEvent>): void;
|
|
574
|
+
trackPurchase(data: TrackPurchaseParams): void;
|
|
575
|
+
trackAddToCart(data?: TrackAddToCartParams): void;
|
|
576
|
+
trackViewContent(data?: TrackViewContentParams): void;
|
|
577
|
+
trackInitiateCheckout(data?: TrackInitiateCheckoutParams): void;
|
|
578
|
+
trackLead(data?: Record<string, any>): void;
|
|
579
|
+
identify(userData: IdentifyParams): void;
|
|
580
|
+
trackSPANavigation(url?: string, title?: string): void;
|
|
581
|
+
resetScrollTracking(): void;
|
|
582
|
+
startPresenceTracking(): void;
|
|
583
|
+
stopPresenceTracking(): void;
|
|
584
|
+
heatmap: {
|
|
585
|
+
enable(): void;
|
|
586
|
+
disable(): void;
|
|
587
|
+
};
|
|
588
|
+
replay: {
|
|
589
|
+
enable(): void;
|
|
590
|
+
disable(): void;
|
|
591
|
+
addFunnelStep(stepData: Record<string, any>): void;
|
|
592
|
+
markConversion(data: Record<string, any>): void;
|
|
593
|
+
};
|
|
594
|
+
enableEnhancedTracking(): boolean;
|
|
595
|
+
disableEnhancedTracking(): void;
|
|
596
|
+
isEnhancedMode(): boolean;
|
|
597
|
+
getVisitorId(): string | null;
|
|
598
|
+
getVisitorInfo(): Promise<VisitorInfo | null>;
|
|
599
|
+
getVisitorHistory(): Promise<VisitorHistory | null>;
|
|
600
|
+
getUserData(): UserData;
|
|
601
|
+
getConversionLikelihood(): ConversionLikelihoodResponse;
|
|
602
|
+
getUserSegment(): UserSegmentResponse;
|
|
603
|
+
config: InternalConfig;
|
|
604
|
+
version: string;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Global window interface extension
|
|
608
|
+
*/
|
|
609
|
+
declare global {
|
|
610
|
+
interface Window {
|
|
611
|
+
Zaplier?: ZaplierSDK$1;
|
|
612
|
+
zaplier?: ZaplierSDK$1;
|
|
613
|
+
stalker?: {
|
|
614
|
+
config?: Partial<SDKConfig>;
|
|
615
|
+
q?: any[][];
|
|
616
|
+
} & ZaplierSDK$1;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Zaplier SDK v1.0.0
|
|
622
|
+
* 100% Cookieless Analytics Tracking
|
|
623
|
+
*
|
|
624
|
+
* Main SDK class for client-side tracking integration
|
|
625
|
+
*/
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Main Zaplier SDK Class
|
|
629
|
+
*/
|
|
630
|
+
declare class ZaplierSDK implements ZaplierSDK$1 {
|
|
631
|
+
config: InternalConfig;
|
|
632
|
+
version: string;
|
|
633
|
+
private visitorId?;
|
|
634
|
+
private backendVisitorId?;
|
|
635
|
+
private sessionId?;
|
|
636
|
+
private fingerprint?;
|
|
637
|
+
private isInitialized;
|
|
638
|
+
private eventQueue;
|
|
639
|
+
private replayEngine?;
|
|
640
|
+
private heatmapEngine?;
|
|
641
|
+
private antiAdblockManager?;
|
|
642
|
+
constructor(userConfig: SDKConfig);
|
|
643
|
+
/**
|
|
644
|
+
* Initialize SDK
|
|
645
|
+
*/
|
|
646
|
+
private initialize;
|
|
647
|
+
/**
|
|
648
|
+
* Initialize tracking engines (Session Replay & Heatmap)
|
|
649
|
+
*/
|
|
650
|
+
private initializeTrackingEngines;
|
|
651
|
+
/**
|
|
652
|
+
* Generate session ID
|
|
653
|
+
*/
|
|
654
|
+
private generateSessionId;
|
|
655
|
+
/**
|
|
656
|
+
* Initialize Anti-Adblock Manager
|
|
657
|
+
*/
|
|
658
|
+
private initializeAntiAdblock;
|
|
659
|
+
/**
|
|
660
|
+
* Collect fingerprint and generate visitor ID (IMPROVED - 2024)
|
|
661
|
+
* Enhanced with better incognito detection
|
|
662
|
+
*/
|
|
663
|
+
private collectFingerprint;
|
|
664
|
+
/**
|
|
665
|
+
* Check if running on localhost
|
|
666
|
+
*/
|
|
667
|
+
private isLocalhost;
|
|
668
|
+
/**
|
|
669
|
+
* Send event to backend
|
|
670
|
+
*/
|
|
671
|
+
private sendEvent;
|
|
672
|
+
/**
|
|
673
|
+
* Make HTTP request to backend using anti-adblock system
|
|
674
|
+
*/
|
|
675
|
+
private makeRequest;
|
|
676
|
+
/**
|
|
677
|
+
* Process queued events
|
|
678
|
+
*/
|
|
679
|
+
private processEventQueue;
|
|
680
|
+
/**
|
|
681
|
+
* Track generic event
|
|
682
|
+
*/
|
|
683
|
+
track(eventType: string, eventData?: Record<string, any>): void;
|
|
684
|
+
/**
|
|
685
|
+
* Track custom event
|
|
686
|
+
*/
|
|
687
|
+
trackCustomEvent(eventName: string, metadata?: Record<string, any>): boolean;
|
|
688
|
+
/**
|
|
689
|
+
* Track conversion event
|
|
690
|
+
*/
|
|
691
|
+
trackConversion(eventName: string, value?: number, currency?: string, metadata?: Record<string, any>): boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Track page view
|
|
694
|
+
*/
|
|
695
|
+
trackPageView(data?: Partial<PageViewEvent>): void;
|
|
696
|
+
/**
|
|
697
|
+
* Track purchase
|
|
698
|
+
*/
|
|
699
|
+
trackPurchase(data: {
|
|
700
|
+
value?: number;
|
|
701
|
+
revenue?: number;
|
|
702
|
+
currency?: string;
|
|
703
|
+
quantity?: number;
|
|
704
|
+
productId?: string;
|
|
705
|
+
productName?: string;
|
|
706
|
+
orderId?: string;
|
|
707
|
+
customData?: Record<string, any>;
|
|
708
|
+
}): void;
|
|
709
|
+
/**
|
|
710
|
+
* Track add to cart
|
|
711
|
+
*/
|
|
712
|
+
trackAddToCart(data?: {
|
|
713
|
+
productId?: string;
|
|
714
|
+
productName?: string;
|
|
715
|
+
price?: number;
|
|
716
|
+
quantity?: number;
|
|
717
|
+
customData?: Record<string, any>;
|
|
718
|
+
}): void;
|
|
719
|
+
/**
|
|
720
|
+
* Track view content
|
|
721
|
+
*/
|
|
722
|
+
trackViewContent(data?: {
|
|
723
|
+
productId?: string;
|
|
724
|
+
productName?: string;
|
|
725
|
+
category?: string;
|
|
726
|
+
customData?: Record<string, any>;
|
|
727
|
+
}): void;
|
|
728
|
+
/**
|
|
729
|
+
* Track initiate checkout
|
|
730
|
+
*/
|
|
731
|
+
trackInitiateCheckout(data?: {
|
|
732
|
+
value?: number;
|
|
733
|
+
currency?: string;
|
|
734
|
+
numItems?: number;
|
|
735
|
+
customData?: Record<string, any>;
|
|
736
|
+
}): void;
|
|
737
|
+
/**
|
|
738
|
+
* Track lead
|
|
739
|
+
*/
|
|
740
|
+
trackLead(data?: Record<string, any>): void;
|
|
741
|
+
/**
|
|
742
|
+
* Identify user
|
|
743
|
+
*/
|
|
744
|
+
identify(userData: {
|
|
745
|
+
email?: string;
|
|
746
|
+
phone?: string;
|
|
747
|
+
[key: string]: any;
|
|
748
|
+
}): void;
|
|
749
|
+
/**
|
|
750
|
+
* Track SPA navigation
|
|
751
|
+
*/
|
|
752
|
+
trackSPANavigation(url?: string, title?: string): void;
|
|
753
|
+
/**
|
|
754
|
+
* Reset scroll tracking
|
|
755
|
+
*/
|
|
756
|
+
resetScrollTracking(): void;
|
|
757
|
+
/**
|
|
758
|
+
* Start presence tracking
|
|
759
|
+
*/
|
|
760
|
+
startPresenceTracking(): void;
|
|
761
|
+
/**
|
|
762
|
+
* Stop presence tracking
|
|
763
|
+
*/
|
|
764
|
+
stopPresenceTracking(): void;
|
|
765
|
+
/**
|
|
766
|
+
* Heatmap API
|
|
767
|
+
*/
|
|
768
|
+
heatmap: {
|
|
769
|
+
enable: () => void;
|
|
770
|
+
disable: () => void;
|
|
771
|
+
enableMouseTracking: () => void;
|
|
772
|
+
disableMouseTracking: () => void;
|
|
773
|
+
getStats: () => {
|
|
774
|
+
clickCount: number;
|
|
775
|
+
maxScrollDepth: number;
|
|
776
|
+
isRecording: boolean;
|
|
777
|
+
mouseMovements: number;
|
|
778
|
+
rageClicks: number;
|
|
779
|
+
} | null;
|
|
780
|
+
isRecording: () => boolean;
|
|
781
|
+
};
|
|
782
|
+
/**
|
|
783
|
+
* Replay API
|
|
784
|
+
*/
|
|
785
|
+
replay: {
|
|
786
|
+
enable: () => void;
|
|
787
|
+
disable: () => void;
|
|
788
|
+
start: () => boolean;
|
|
789
|
+
stop: () => void;
|
|
790
|
+
isRecording: () => boolean;
|
|
791
|
+
getEventCount: () => number;
|
|
792
|
+
addFunnelStep: (stepData: Record<string, any>) => void;
|
|
793
|
+
markConversion: (data: Record<string, any>) => void;
|
|
794
|
+
};
|
|
795
|
+
/**
|
|
796
|
+
* Enable enhanced tracking
|
|
797
|
+
*/
|
|
798
|
+
enableEnhancedTracking(): boolean;
|
|
799
|
+
/**
|
|
800
|
+
* Disable enhanced tracking
|
|
801
|
+
*/
|
|
802
|
+
disableEnhancedTracking(): void;
|
|
803
|
+
/**
|
|
804
|
+
* Check if enhanced mode is active
|
|
805
|
+
*/
|
|
806
|
+
isEnhancedMode(): boolean;
|
|
807
|
+
/**
|
|
808
|
+
* Get visitor ID (real UUID from backend, or fallback)
|
|
809
|
+
*/
|
|
810
|
+
getVisitorId(): string | null;
|
|
811
|
+
/**
|
|
812
|
+
* Get visitor information from backend
|
|
813
|
+
* Returns detailed visitor data including location, device info, and stats
|
|
814
|
+
*
|
|
815
|
+
* IMPORTANT: Only uses backendVisitorId (UUID), not the local visitorId with 'vis_' prefix
|
|
816
|
+
*/
|
|
817
|
+
getVisitorInfo(): Promise<VisitorInfo | null>;
|
|
818
|
+
/**
|
|
819
|
+
* Get visitor history (visits/events)
|
|
820
|
+
* Returns visit history with location, IP, incognito, VPN detection
|
|
821
|
+
*/
|
|
822
|
+
getVisitorHistory(): Promise<VisitorHistory | null>;
|
|
823
|
+
/**
|
|
824
|
+
* Get user data
|
|
825
|
+
*/
|
|
826
|
+
getUserData(): UserData;
|
|
827
|
+
/**
|
|
828
|
+
* Get conversion likelihood (mock implementation)
|
|
829
|
+
*/
|
|
830
|
+
getConversionLikelihood(): {
|
|
831
|
+
score: number;
|
|
832
|
+
factors: string[];
|
|
833
|
+
};
|
|
834
|
+
/**
|
|
835
|
+
* Get user segment (mock implementation)
|
|
836
|
+
*/
|
|
837
|
+
getUserSegment(): {
|
|
838
|
+
type: "high_intent" | "medium_intent" | "exploring";
|
|
839
|
+
confidence: number;
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Global Interface for Zaplier SDK
|
|
845
|
+
* Provides unified API for both Script tag and NPM usage
|
|
846
|
+
*/
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Unified Zaplier interface
|
|
850
|
+
*/
|
|
851
|
+
declare const Zaplier: {
|
|
852
|
+
/**
|
|
853
|
+
* Initialize SDK
|
|
854
|
+
*/
|
|
855
|
+
init: (config: SDKConfig) => ZaplierSDK;
|
|
856
|
+
/**
|
|
857
|
+
* Get current instance
|
|
858
|
+
*/
|
|
859
|
+
getInstance: () => ZaplierSDK | null;
|
|
860
|
+
/**
|
|
861
|
+
* Track custom event
|
|
862
|
+
*/
|
|
863
|
+
track: (eventType: string, eventData?: Record<string, any>) => void;
|
|
864
|
+
/**
|
|
865
|
+
* Track page view
|
|
866
|
+
*/
|
|
867
|
+
trackPageView: (data?: any) => void;
|
|
868
|
+
/**
|
|
869
|
+
* Track custom event (alias for track)
|
|
870
|
+
*/
|
|
871
|
+
trackEvent: (eventName: string, metadata?: Record<string, any>) => boolean;
|
|
872
|
+
/**
|
|
873
|
+
* Track conversion
|
|
874
|
+
*/
|
|
875
|
+
trackConversion: (conversionType: string, value?: number, currency?: string, metadata?: Record<string, any>) => void;
|
|
876
|
+
/**
|
|
877
|
+
* Track purchase
|
|
878
|
+
*/
|
|
879
|
+
trackPurchase: (data: {
|
|
880
|
+
value: number;
|
|
881
|
+
currency?: string;
|
|
882
|
+
items?: Array<{
|
|
883
|
+
id: string;
|
|
884
|
+
name: string;
|
|
885
|
+
category?: string;
|
|
886
|
+
quantity?: number;
|
|
887
|
+
price?: number;
|
|
888
|
+
}>;
|
|
889
|
+
orderId?: string;
|
|
890
|
+
coupon?: string;
|
|
891
|
+
}) => void;
|
|
892
|
+
/**
|
|
893
|
+
* Track add to cart
|
|
894
|
+
*/
|
|
895
|
+
trackAddToCart: (data?: {
|
|
896
|
+
productId?: string;
|
|
897
|
+
productName?: string;
|
|
898
|
+
price?: number;
|
|
899
|
+
quantity?: number;
|
|
900
|
+
customData?: Record<string, any>;
|
|
901
|
+
}) => void;
|
|
902
|
+
/**
|
|
903
|
+
* Identify user
|
|
904
|
+
*/
|
|
905
|
+
identify: (userData: {
|
|
906
|
+
email?: string;
|
|
907
|
+
name?: string;
|
|
908
|
+
id?: string;
|
|
909
|
+
properties?: Record<string, any>;
|
|
910
|
+
}) => void;
|
|
911
|
+
/**
|
|
912
|
+
* Get visitor ID
|
|
913
|
+
*/
|
|
914
|
+
getVisitorId: () => string | null;
|
|
915
|
+
/**
|
|
916
|
+
* Get visitor info
|
|
917
|
+
*/
|
|
918
|
+
getVisitorInfo: () => Promise<any>;
|
|
919
|
+
/**
|
|
920
|
+
* Get user data
|
|
921
|
+
*/
|
|
922
|
+
getUserData: () => any;
|
|
923
|
+
/**
|
|
924
|
+
* Enable enhanced tracking
|
|
925
|
+
*/
|
|
926
|
+
enableEnhancedTracking: () => boolean;
|
|
927
|
+
/**
|
|
928
|
+
* Disable enhanced tracking
|
|
929
|
+
*/
|
|
930
|
+
disableEnhancedTracking: () => void;
|
|
931
|
+
/**
|
|
932
|
+
* Check if enhanced mode is active
|
|
933
|
+
*/
|
|
934
|
+
isEnhancedMode: () => boolean;
|
|
935
|
+
/**
|
|
936
|
+
* Heatmap controls
|
|
937
|
+
*/
|
|
938
|
+
heatmap: {
|
|
939
|
+
enable: () => void;
|
|
940
|
+
disable: () => void;
|
|
941
|
+
enableMouseTracking: () => void;
|
|
942
|
+
disableMouseTracking: () => void;
|
|
943
|
+
getStats: () => {
|
|
944
|
+
clickCount: number;
|
|
945
|
+
maxScrollDepth: number;
|
|
946
|
+
isRecording: boolean;
|
|
947
|
+
mouseMovements: number;
|
|
948
|
+
rageClicks: number;
|
|
949
|
+
} | null;
|
|
950
|
+
isRecording: () => boolean;
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* Session replay controls
|
|
954
|
+
*/
|
|
955
|
+
replay: {
|
|
956
|
+
enable: () => void;
|
|
957
|
+
disable: () => void;
|
|
958
|
+
start: () => boolean;
|
|
959
|
+
stop: () => void;
|
|
960
|
+
isRecording: () => boolean;
|
|
961
|
+
getEventCount: () => number;
|
|
962
|
+
addFunnelStep: (stepData: Record<string, any>) => void;
|
|
963
|
+
markConversion: (data: Record<string, any>) => void;
|
|
964
|
+
};
|
|
965
|
+
/**
|
|
966
|
+
* Debug and utility functions
|
|
967
|
+
*/
|
|
968
|
+
debug: {
|
|
969
|
+
getStats: () => any;
|
|
970
|
+
getSuccessRates: () => any;
|
|
971
|
+
testTransports: () => any;
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* Version info
|
|
975
|
+
*/
|
|
976
|
+
version: string;
|
|
977
|
+
};
|
|
978
|
+
/**
|
|
979
|
+
* Auto-initialization from script tag data attributes
|
|
980
|
+
*/
|
|
981
|
+
declare function autoInitializeFromScript(): void;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Fingerprint Orchestrator
|
|
985
|
+
* Main fingerprinting engine that coordinates all components
|
|
986
|
+
* Based on FingerprintJS architecture with privacy-first approach
|
|
987
|
+
*/
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Main fingerprint collection function
|
|
991
|
+
*/
|
|
992
|
+
declare function collectFingerprint(options?: Partial<FingerprintOptions>): Promise<FingerprintResult>;
|
|
993
|
+
/**
|
|
994
|
+
* Generate visitor ID from fingerprint
|
|
995
|
+
*/
|
|
996
|
+
declare function generateVisitorIdFromFingerprint(fingerprintData: FingerprintData): string;
|
|
997
|
+
/**
|
|
998
|
+
* Get a lightweight fingerprint (GDPR-compliant)
|
|
999
|
+
*/
|
|
1000
|
+
declare function getLightweightFingerprint(): Promise<FingerprintResult>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Get a complete fingerprint (enhanced mode)
|
|
1003
|
+
*/
|
|
1004
|
+
declare function getCompleteFingerprint(): Promise<FingerprintResult>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Clear session fingerprint cache (memory only)
|
|
1007
|
+
*/
|
|
1008
|
+
declare function clearFingerprintCache(): void;
|
|
1009
|
+
/**
|
|
1010
|
+
* Check if fingerprinting is available
|
|
1011
|
+
*/
|
|
1012
|
+
declare function isFingerprintingAvailable(): boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* Get available fingerprinting components
|
|
1015
|
+
*/
|
|
1016
|
+
declare function getAvailableComponents(): FingerprintComponentType[];
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Detection Types
|
|
1020
|
+
*
|
|
1021
|
+
* Types for bot detection and incognito detection functionality
|
|
1022
|
+
*/
|
|
1023
|
+
/**
|
|
1024
|
+
* Generic detection result
|
|
1025
|
+
*/
|
|
1026
|
+
interface DetectionResult {
|
|
1027
|
+
detected: boolean;
|
|
1028
|
+
confidence: number;
|
|
1029
|
+
method: string;
|
|
1030
|
+
details?: Record<string, any>;
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Bot detection result
|
|
1034
|
+
*/
|
|
1035
|
+
interface BotDetectionResult {
|
|
1036
|
+
isBot: boolean;
|
|
1037
|
+
confidence: number;
|
|
1038
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
1039
|
+
detectionMethods: string[];
|
|
1040
|
+
detectors?: BotDetectionMethods;
|
|
1041
|
+
userAgent?: UserAgentAnalysis;
|
|
1042
|
+
details?: {
|
|
1043
|
+
userAgent?: string;
|
|
1044
|
+
suspiciousPatterns?: string[];
|
|
1045
|
+
timing?: Record<string, number>;
|
|
1046
|
+
capabilities?: Record<string, boolean>;
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Bot detection methods interface
|
|
1051
|
+
*/
|
|
1052
|
+
interface BotDetectionMethods {
|
|
1053
|
+
[key: string]: DetectionResult;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Incognito detection result
|
|
1057
|
+
*/
|
|
1058
|
+
interface IncognitoDetectionResult {
|
|
1059
|
+
isIncognito: boolean;
|
|
1060
|
+
confidence: number;
|
|
1061
|
+
detectionMethods: string[];
|
|
1062
|
+
details?: {
|
|
1063
|
+
localStorage?: boolean | null;
|
|
1064
|
+
sessionStorage?: boolean | null;
|
|
1065
|
+
indexedDB?: boolean | null;
|
|
1066
|
+
cookiesEnabled?: boolean | null;
|
|
1067
|
+
quota?: number | null;
|
|
1068
|
+
permissions?: Record<string, any>;
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* User agent analysis result
|
|
1073
|
+
*/
|
|
1074
|
+
interface UserAgentAnalysis {
|
|
1075
|
+
browser: {
|
|
1076
|
+
name: string;
|
|
1077
|
+
version: string;
|
|
1078
|
+
major: string;
|
|
1079
|
+
engine: string;
|
|
1080
|
+
};
|
|
1081
|
+
os: {
|
|
1082
|
+
name: string;
|
|
1083
|
+
version: string;
|
|
1084
|
+
family?: string;
|
|
1085
|
+
};
|
|
1086
|
+
device: {
|
|
1087
|
+
type: string;
|
|
1088
|
+
vendor?: string;
|
|
1089
|
+
model?: string;
|
|
1090
|
+
};
|
|
1091
|
+
cpu?: {
|
|
1092
|
+
architecture: string;
|
|
1093
|
+
};
|
|
1094
|
+
suspicious?: {
|
|
1095
|
+
isBot: boolean;
|
|
1096
|
+
patterns: string[];
|
|
1097
|
+
category: string;
|
|
1098
|
+
};
|
|
1099
|
+
isMobile: boolean;
|
|
1100
|
+
isTablet: boolean;
|
|
1101
|
+
isDesktop: boolean;
|
|
1102
|
+
isBot: boolean;
|
|
1103
|
+
raw: string;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* Bot Detection Module
|
|
1108
|
+
* Comprehensive client-side bot detection based on multiple techniques
|
|
1109
|
+
* Detects headless browsers, automation tools, and suspicious behavior
|
|
1110
|
+
*/
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Main bot detection function
|
|
1114
|
+
*/
|
|
1115
|
+
declare function detectBot(): Promise<BotDetectionResult>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Quick bot detection (faster, less comprehensive)
|
|
1118
|
+
*/
|
|
1119
|
+
declare function quickBotDetection(): Promise<boolean>;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Incognito Mode Detection (Analytics Only)
|
|
1123
|
+
*
|
|
1124
|
+
* Detects private/incognito browsing mode for analytics purposes only.
|
|
1125
|
+
* Does NOT use localStorage/sessionStorage for tracking or data persistence.
|
|
1126
|
+
* Used only to enrich analytics data with browser context information.
|
|
1127
|
+
*/
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Main incognito detection function (IMPROVED - 2024)
|
|
1131
|
+
*
|
|
1132
|
+
* Enhanced with:
|
|
1133
|
+
* - Weighted scoring system to reduce false positives
|
|
1134
|
+
* - Browser-specific detection weights
|
|
1135
|
+
* - Multi-signal validation requirements
|
|
1136
|
+
* - Improved confidence thresholds
|
|
1137
|
+
*/
|
|
1138
|
+
declare function detectIncognitoMode(): Promise<IncognitoDetectionResult>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Quick incognito detection (less comprehensive but faster)
|
|
1141
|
+
*/
|
|
1142
|
+
declare function quickIncognitoDetection(): Promise<boolean>;
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Enhanced User Agent Parser
|
|
1146
|
+
* Based on FingerprintJS browser detection with advanced engine and version parsing
|
|
1147
|
+
*/
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Browser engine detection (based on FingerprintJS)
|
|
1151
|
+
*/
|
|
1152
|
+
declare function isChromium(): boolean;
|
|
1153
|
+
declare function isWebKit(): boolean;
|
|
1154
|
+
declare function isGecko(): boolean;
|
|
1155
|
+
declare function isSamsungInternet(): boolean;
|
|
1156
|
+
declare function isIPad(): boolean;
|
|
1157
|
+
declare function isAndroid(): boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* Enhanced user agent analysis
|
|
1160
|
+
*/
|
|
1161
|
+
declare function analyzeUserAgent(userAgent?: string): UserAgentAnalysis;
|
|
1162
|
+
/**
|
|
1163
|
+
* Get browser engine type
|
|
1164
|
+
*/
|
|
1165
|
+
declare function getBrowserEngine(): 'chromium' | 'webkit' | 'gecko' | 'trident' | 'unknown';
|
|
1166
|
+
/**
|
|
1167
|
+
* Check if running on mobile device
|
|
1168
|
+
*/
|
|
1169
|
+
declare function isMobile(): boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Check if running on tablet
|
|
1172
|
+
*/
|
|
1173
|
+
declare function isTablet(): boolean;
|
|
1174
|
+
/**
|
|
1175
|
+
* Check if running on desktop
|
|
1176
|
+
*/
|
|
1177
|
+
declare function isDesktop(): boolean;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* MurmurHash3 x64 Implementation
|
|
1181
|
+
* Based on FingerprintJS hashing utility for consistent fingerprint generation
|
|
1182
|
+
*
|
|
1183
|
+
* Provides 128-bit hash output using the x64 variant of MurmurHash3
|
|
1184
|
+
*/
|
|
1185
|
+
/**
|
|
1186
|
+
* MurmurHash3 x64 128-bit hash function
|
|
1187
|
+
* Returns a 128-bit hash as a hex string
|
|
1188
|
+
*/
|
|
1189
|
+
declare function x64hash128(input: string, seed?: number): string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Simple 32-bit hash for basic use cases
|
|
1192
|
+
*/
|
|
1193
|
+
declare function hash32(input: string): string;
|
|
1194
|
+
/**
|
|
1195
|
+
* Hash fingerprint components into a stable identifier
|
|
1196
|
+
*/
|
|
1197
|
+
declare function hashFingerprint(components: Record<string, any>): string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Generate a visitor ID from fingerprint hash
|
|
1200
|
+
*/
|
|
1201
|
+
declare function generateVisitorId(fingerprintHash: string): string;
|
|
1202
|
+
|
|
1203
|
+
export { Zaplier, ZaplierSDK, analyzeUserAgent, autoInitializeFromScript, clearFingerprintCache, collectFingerprint, ZaplierSDK as default, detectBot, detectIncognitoMode, generateVisitorId, generateVisitorIdFromFingerprint, getAvailableComponents, getBrowserEngine, getCompleteFingerprint, getLightweightFingerprint, hash32, hashFingerprint, isAndroid, isChromium, isDesktop, isFingerprintingAvailable, isGecko, isIPad, isMobile, isSamsungInternet, isTablet, isWebKit, quickBotDetection, quickIncognitoDetection, x64hash128 };
|
|
1204
|
+
export type { AudioFingerprint, BaseEventData, BotDetectionResult$1 as BotDetectionResult, BrowserFingerprint, CanvasFingerprint, ConfigKey, ConversionEvent, ConversionLikelihoodResponse, CustomEvent, EcommerceEvent, BotDetectionResult$2 as EventBotDetectionResult, EventData, IncognitoDetectionResult$2 as EventIncognitoDetectionResult, EventPayload, FingerprintComponent, FingerprintComponentType, FingerprintComponents, FingerprintData, FingerprintOptions, FingerprintResult, FontFingerprint, IdentifyEvent, IdentifyParams, IncognitoDetectionResult$1 as IncognitoDetectionResult, InternalConfig, InternalConfigKey, PageViewEvent, SDKConfig, ScreenFingerprint, TrackAddToCartParams, TrackConversionParams, TrackCustomEventParams, TrackInitiateCheckoutParams, TrackPurchaseParams, TrackViewContentParams, UserAgentAnalysis$1 as UserAgentAnalysis, UserData, UserSegmentResponse, VisitHistoryEntry, VisitorHistory, VisitorInfo, WebGLFingerprint };
|