@v-tilt/browser 1.1.0 → 1.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.
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/constants.d.ts +172 -10
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +181 -49
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +181 -49
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/session.d.ts +2 -2
- package/dist/types.d.ts +153 -37
- package/dist/user-manager.d.ts +2 -2
- package/dist/vtilt.d.ts +19 -11
- package/lib/config.js +9 -13
- package/lib/constants.d.ts +172 -10
- package/lib/constants.js +608 -403
- package/lib/request.js +13 -13
- package/lib/session.d.ts +2 -2
- package/lib/session.js +3 -3
- package/lib/types.d.ts +153 -37
- package/lib/types.js +6 -0
- package/lib/user-manager.d.ts +2 -2
- package/lib/user-manager.js +38 -11
- package/lib/vtilt.d.ts +19 -11
- package/lib/vtilt.js +75 -42
- package/lib/web-vitals.js +1 -1
- package/package.json +13 -12
- package/LICENSE +0 -21
package/dist/session.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PersistenceMethod } from "./types";
|
|
2
2
|
export declare class SessionManager {
|
|
3
3
|
private storageMethod;
|
|
4
4
|
private domain?;
|
|
5
5
|
private _windowId;
|
|
6
|
-
constructor(storageMethod?:
|
|
6
|
+
constructor(storageMethod?: PersistenceMethod, domain?: string);
|
|
7
7
|
/**
|
|
8
8
|
* Check if using web storage (localStorage or sessionStorage)
|
|
9
9
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -1,69 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VTilt Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the VTilt tracking SDK.
|
|
5
|
+
* Following PostHog's patterns where applicable.
|
|
6
|
+
*/
|
|
7
|
+
import type { PersonProfilesMode } from "./constants";
|
|
1
8
|
export interface VTiltConfig {
|
|
2
|
-
|
|
9
|
+
/** Project identifier (required) */
|
|
3
10
|
token: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
/** API host for tracking (default: https://api.vtilt.io) */
|
|
12
|
+
api_host?: string;
|
|
13
|
+
/** UI host for dashboard links */
|
|
14
|
+
ui_host?: string | null;
|
|
15
|
+
/** Proxy domain for tracking requests */
|
|
7
16
|
proxy?: string;
|
|
17
|
+
/** Full proxy URL for tracking requests */
|
|
8
18
|
proxyUrl?: string;
|
|
19
|
+
/** Instance name (for multiple instances) */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Project ID (set via init() first argument) */
|
|
22
|
+
projectId?: string;
|
|
23
|
+
/** Domain to track (auto-detected if not provided) */
|
|
9
24
|
domain?: string;
|
|
10
|
-
|
|
25
|
+
/** Storage method for session data */
|
|
26
|
+
storage?: PersistenceMethod;
|
|
27
|
+
/** Persistence method for user data */
|
|
28
|
+
persistence?: PersistenceMethod;
|
|
29
|
+
/** Persistence name prefix */
|
|
30
|
+
persistence_name?: string;
|
|
31
|
+
/** Enable cross-subdomain cookies */
|
|
32
|
+
cross_subdomain_cookie?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Person profiles mode:
|
|
35
|
+
* - 'always': Always create person profiles (default)
|
|
36
|
+
* - 'identified_only': Only create when user is identified
|
|
37
|
+
* - 'never': Never create person profiles
|
|
38
|
+
*/
|
|
39
|
+
person_profiles?: PersonProfilesMode;
|
|
40
|
+
/** Enable autocapture */
|
|
41
|
+
autocapture?: boolean;
|
|
42
|
+
/** Enable web vitals tracking */
|
|
43
|
+
capture_performance?: boolean;
|
|
44
|
+
/** Enable page view tracking */
|
|
45
|
+
capture_pageview?: boolean | "auto";
|
|
46
|
+
/** Enable page leave tracking */
|
|
47
|
+
capture_pageleave?: boolean | "if_capture_pageview";
|
|
48
|
+
/** Disable compression */
|
|
49
|
+
disable_compression?: boolean;
|
|
50
|
+
/** Whether to stringify payload before sending */
|
|
11
51
|
stringifyPayload?: boolean;
|
|
12
|
-
|
|
52
|
+
/** Properties to exclude from events */
|
|
53
|
+
property_denylist?: string[];
|
|
54
|
+
/** Mask text in autocapture */
|
|
55
|
+
mask_all_text?: boolean;
|
|
56
|
+
/** Mask all element attributes */
|
|
57
|
+
mask_all_element_attributes?: boolean;
|
|
58
|
+
/** Respect Do Not Track browser setting */
|
|
59
|
+
respect_dnt?: boolean;
|
|
60
|
+
/** Opt users out by default */
|
|
61
|
+
opt_out_capturing_by_default?: boolean;
|
|
62
|
+
/** Global attributes added to all events */
|
|
13
63
|
globalAttributes?: Record<string, string>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value: number;
|
|
25
|
-
delta: number;
|
|
26
|
-
rating: string;
|
|
27
|
-
id: string;
|
|
28
|
-
navigationType: string;
|
|
29
|
-
}
|
|
30
|
-
export interface GeolocationData {
|
|
31
|
-
country?: string;
|
|
32
|
-
locale?: string;
|
|
64
|
+
/** Bootstrap data for initialization */
|
|
65
|
+
bootstrap?: {
|
|
66
|
+
distinctID?: string;
|
|
67
|
+
isIdentifiedID?: boolean;
|
|
68
|
+
featureFlags?: Record<string, boolean | string>;
|
|
69
|
+
};
|
|
70
|
+
/** Before send hook for modifying events */
|
|
71
|
+
before_send?: (event: CaptureResult) => CaptureResult | null;
|
|
72
|
+
/** Loaded callback */
|
|
73
|
+
loaded?: (vtilt: any) => void;
|
|
33
74
|
}
|
|
34
75
|
export interface EventPayload {
|
|
35
76
|
[key: string]: any;
|
|
36
77
|
}
|
|
78
|
+
export interface CaptureResult {
|
|
79
|
+
uuid: string;
|
|
80
|
+
event: string;
|
|
81
|
+
properties: Properties;
|
|
82
|
+
$set?: Properties;
|
|
83
|
+
$set_once?: Properties;
|
|
84
|
+
timestamp?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface CaptureOptions {
|
|
87
|
+
/** Override timestamp */
|
|
88
|
+
timestamp?: Date;
|
|
89
|
+
/** Properties to $set on person */
|
|
90
|
+
$set?: Properties;
|
|
91
|
+
/** Properties to $set_once on person */
|
|
92
|
+
$set_once?: Properties;
|
|
93
|
+
/** Send immediately (skip batching) */
|
|
94
|
+
send_instantly?: boolean;
|
|
95
|
+
}
|
|
37
96
|
export interface TrackingEvent {
|
|
38
97
|
timestamp: string;
|
|
39
98
|
event: string;
|
|
40
99
|
project_id: string;
|
|
41
100
|
domain: string;
|
|
42
|
-
|
|
43
|
-
distinct_id?: string;
|
|
101
|
+
distinct_id: string;
|
|
44
102
|
anonymous_id?: string;
|
|
103
|
+
payload: EventPayload;
|
|
104
|
+
}
|
|
105
|
+
export type Property = string | number | boolean | null | undefined | Date | any[] | Record<string, any>;
|
|
106
|
+
export interface Properties {
|
|
107
|
+
[key: string]: Property;
|
|
108
|
+
}
|
|
109
|
+
export interface PropertyOperations {
|
|
110
|
+
$set?: Properties;
|
|
111
|
+
$set_once?: Properties;
|
|
112
|
+
$unset?: string[];
|
|
45
113
|
}
|
|
46
|
-
export
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
localStorage: "localStorage";
|
|
50
|
-
sessionStorage: "sessionStorage";
|
|
114
|
+
export interface SessionData {
|
|
115
|
+
value: string;
|
|
116
|
+
expiry: number;
|
|
51
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Persistence method for user/session data
|
|
120
|
+
* Following PostHog's approach:
|
|
121
|
+
* - 'localStorage+cookie': Stores limited data in cookies, rest in localStorage (default)
|
|
122
|
+
* - 'cookie': Stores all data in cookies
|
|
123
|
+
* - 'localStorage': Stores all data in localStorage
|
|
124
|
+
* - 'sessionStorage': Stores all data in sessionStorage
|
|
125
|
+
* - 'memory': Stores all data in memory only (no persistence)
|
|
126
|
+
*/
|
|
127
|
+
export type PersistenceMethod = "localStorage+cookie" | "cookie" | "localStorage" | "sessionStorage" | "memory";
|
|
128
|
+
/** User identity state */
|
|
52
129
|
export interface UserIdentity {
|
|
130
|
+
/** Current distinct ID (null if anonymous) */
|
|
53
131
|
distinct_id: string | null;
|
|
132
|
+
/** Anonymous ID (always present) */
|
|
54
133
|
anonymous_id: string;
|
|
134
|
+
/** Device ID (persists across sessions) */
|
|
55
135
|
device_id: string;
|
|
56
|
-
properties
|
|
136
|
+
/** User properties */
|
|
137
|
+
properties: Properties;
|
|
138
|
+
/** Identity state */
|
|
57
139
|
user_state: "anonymous" | "identified";
|
|
58
140
|
}
|
|
59
141
|
export interface UserProperties {
|
|
60
142
|
[key: string]: any;
|
|
61
143
|
}
|
|
62
|
-
export interface PropertyOperations {
|
|
63
|
-
$set?: Record<string, any>;
|
|
64
|
-
$set_once?: Record<string, any>;
|
|
65
|
-
}
|
|
66
144
|
export interface AliasEvent {
|
|
67
145
|
distinct_id: string;
|
|
68
146
|
original: string;
|
|
69
147
|
}
|
|
148
|
+
export interface WebVitalMetric {
|
|
149
|
+
name: string;
|
|
150
|
+
value: number;
|
|
151
|
+
delta: number;
|
|
152
|
+
rating: "good" | "needs-improvement" | "poor";
|
|
153
|
+
id: string;
|
|
154
|
+
navigationType: string;
|
|
155
|
+
}
|
|
156
|
+
export interface GeolocationData {
|
|
157
|
+
country?: string;
|
|
158
|
+
locale?: string;
|
|
159
|
+
}
|
|
160
|
+
export interface GroupsConfig {
|
|
161
|
+
[groupType: string]: string;
|
|
162
|
+
}
|
|
163
|
+
export interface FeatureFlagsConfig {
|
|
164
|
+
[flagKey: string]: boolean | string;
|
|
165
|
+
}
|
|
166
|
+
export type SessionIdChangedCallback = (newSessionId: string, previousSessionId: string | null, changeInfo: {
|
|
167
|
+
reason: "timeout" | "new_session" | "reset";
|
|
168
|
+
}) => void;
|
|
169
|
+
export interface RequestOptions {
|
|
170
|
+
method?: "POST" | "GET";
|
|
171
|
+
headers?: Record<string, string>;
|
|
172
|
+
timeout?: number;
|
|
173
|
+
retry?: boolean;
|
|
174
|
+
}
|
|
175
|
+
export interface RemoteConfig {
|
|
176
|
+
/** Default to identified_only mode */
|
|
177
|
+
defaultIdentifiedOnly?: boolean;
|
|
178
|
+
/** Feature flags */
|
|
179
|
+
featureFlags?: FeatureFlagsConfig;
|
|
180
|
+
/** Session recording config */
|
|
181
|
+
sessionRecording?: {
|
|
182
|
+
enabled?: boolean;
|
|
183
|
+
sampleRate?: number;
|
|
184
|
+
};
|
|
185
|
+
}
|
package/dist/user-manager.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { UserIdentity, AliasEvent,
|
|
1
|
+
import { UserIdentity, AliasEvent, PersistenceMethod } from "./types";
|
|
2
2
|
export declare class UserManager {
|
|
3
3
|
private storageMethod;
|
|
4
4
|
private domain?;
|
|
5
5
|
private userIdentity;
|
|
6
6
|
private _cachedPersonProperties;
|
|
7
|
-
constructor(storageMethod?:
|
|
7
|
+
constructor(storageMethod?: PersistenceMethod, domain?: string);
|
|
8
8
|
/**
|
|
9
9
|
* Get current user identity
|
|
10
10
|
*/
|
package/dist/vtilt.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ export declare class VTilt {
|
|
|
11
11
|
private rateLimiter;
|
|
12
12
|
historyAutocapture?: HistoryAutocapture;
|
|
13
13
|
__loaded: boolean;
|
|
14
|
-
private
|
|
15
|
-
private
|
|
14
|
+
private _initial_pageview_captured;
|
|
15
|
+
private _visibility_state_listener;
|
|
16
16
|
__request_queue: QueuedRequest[];
|
|
17
|
-
private
|
|
18
|
-
private
|
|
17
|
+
private _has_warned_about_config;
|
|
18
|
+
private _set_once_properties_sent;
|
|
19
19
|
constructor(config?: Partial<VTiltConfig>);
|
|
20
20
|
/**
|
|
21
21
|
* Initializes a new instance of the VTilt tracking object.
|
|
@@ -53,11 +53,17 @@ export declare class VTilt {
|
|
|
53
53
|
* This internal method should only be called by `init()`.
|
|
54
54
|
*/
|
|
55
55
|
private _init;
|
|
56
|
+
/**
|
|
57
|
+
* Start the request queue if user hasn't opted out
|
|
58
|
+
* Following PostHog's pattern - called from both _init() and _dom_loaded()
|
|
59
|
+
* Safe to call multiple times as enable() is idempotent
|
|
60
|
+
*/
|
|
61
|
+
private _start_queue_if_opted_in;
|
|
56
62
|
/**
|
|
57
63
|
* Set up handler to flush event queue on page unload
|
|
58
64
|
* Uses both beforeunload and pagehide for maximum compatibility
|
|
59
65
|
*/
|
|
60
|
-
private
|
|
66
|
+
private _setup_unload_handler;
|
|
61
67
|
/**
|
|
62
68
|
* Returns a string representation of the instance name
|
|
63
69
|
* Used for debugging and logging
|
|
@@ -75,7 +81,7 @@ export declare class VTilt {
|
|
|
75
81
|
* Returns true if projectId and token are present, false otherwise
|
|
76
82
|
* Logs a warning only once per instance if not configured
|
|
77
83
|
*/
|
|
78
|
-
private
|
|
84
|
+
private _is_configured;
|
|
79
85
|
/**
|
|
80
86
|
* Build the tracking URL with token in query parameters
|
|
81
87
|
*/
|
|
@@ -91,18 +97,18 @@ export declare class VTilt {
|
|
|
91
97
|
* Called by RequestQueue when flushing
|
|
92
98
|
* Uses RetryQueue for automatic retry on failure
|
|
93
99
|
*/
|
|
94
|
-
private
|
|
100
|
+
private _send_batched_request;
|
|
95
101
|
/**
|
|
96
102
|
* Send HTTP request and return status code
|
|
97
103
|
* Uses GZip compression for payloads > 1KB
|
|
98
104
|
* Used by RetryQueue for retryable requests
|
|
99
105
|
*/
|
|
100
|
-
private
|
|
106
|
+
private _send_http_request;
|
|
101
107
|
/**
|
|
102
108
|
* Send request using sendBeacon for reliable delivery on page unload
|
|
103
109
|
* Uses GZip compression for payloads > 1KB
|
|
104
110
|
*/
|
|
105
|
-
private
|
|
111
|
+
private _send_beacon_request;
|
|
106
112
|
/**
|
|
107
113
|
* Send a queued request (called after DOM is loaded)
|
|
108
114
|
*/
|
|
@@ -125,7 +131,7 @@ export declare class VTilt {
|
|
|
125
131
|
* Internal capture method that bypasses rate limiting
|
|
126
132
|
* Used for system events like rate limit warnings
|
|
127
133
|
*/
|
|
128
|
-
private
|
|
134
|
+
private _capture_internal;
|
|
129
135
|
/**
|
|
130
136
|
* Track a custom event (alias for capture)
|
|
131
137
|
*/
|
|
@@ -219,8 +225,9 @@ export declare class VTilt {
|
|
|
219
225
|
createAlias(alias: string, original?: string): void;
|
|
220
226
|
/**
|
|
221
227
|
* Capture initial pageview with visibility check
|
|
228
|
+
* Note: The capture_pageview config check happens at the call site (in _init)
|
|
222
229
|
*/
|
|
223
|
-
private
|
|
230
|
+
private _capture_initial_pageview;
|
|
224
231
|
/**
|
|
225
232
|
* Get current configuration
|
|
226
233
|
*/
|
|
@@ -247,6 +254,7 @@ export declare class VTilt {
|
|
|
247
254
|
_execute_array(array: any[]): void;
|
|
248
255
|
/**
|
|
249
256
|
* Called when DOM is loaded - processes queued requests and enables batching
|
|
257
|
+
* Following PostHog's pattern in _dom_loaded()
|
|
250
258
|
*/
|
|
251
259
|
_dom_loaded(): void;
|
|
252
260
|
}
|
package/lib/config.js
CHANGED
|
@@ -11,19 +11,20 @@ class ConfigManager {
|
|
|
11
11
|
parseConfigFromScript(initialConfig) {
|
|
12
12
|
if (!document.currentScript) {
|
|
13
13
|
return {
|
|
14
|
-
projectId: initialConfig.projectId || "",
|
|
15
14
|
token: initialConfig.token || "",
|
|
16
15
|
...initialConfig,
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
const script = document.currentScript;
|
|
20
19
|
const config = {
|
|
21
|
-
projectId: "", // Required field with default
|
|
22
20
|
token: "", // Required field with default
|
|
23
21
|
...initialConfig,
|
|
24
22
|
};
|
|
25
23
|
// Parse basic attributes
|
|
26
|
-
config.
|
|
24
|
+
config.api_host =
|
|
25
|
+
script.getAttribute("data-api-host") ||
|
|
26
|
+
script.getAttribute("data-host") ||
|
|
27
|
+
initialConfig.api_host;
|
|
27
28
|
config.proxy = script.getAttribute("data-proxy") || initialConfig.proxy;
|
|
28
29
|
config.proxyUrl =
|
|
29
30
|
script.getAttribute("data-proxy-url") || initialConfig.proxyUrl;
|
|
@@ -36,24 +37,19 @@ class ConfigManager {
|
|
|
36
37
|
script.getAttribute("data-storage") || initialConfig.storage;
|
|
37
38
|
config.stringifyPayload =
|
|
38
39
|
script.getAttribute("data-stringify-payload") !== "false";
|
|
39
|
-
config.
|
|
40
|
-
script.getAttribute("
|
|
41
|
-
|
|
42
|
-
initialConfig.webVitals;
|
|
40
|
+
config.capture_performance =
|
|
41
|
+
script.getAttribute("data-capture-performance") === "true" ||
|
|
42
|
+
initialConfig.capture_performance;
|
|
43
43
|
// Check for conflicting proxy configurations
|
|
44
44
|
if (config.proxy && config.proxyUrl) {
|
|
45
45
|
console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them.");
|
|
46
46
|
throw new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");
|
|
47
47
|
}
|
|
48
|
-
// Parse global attributes
|
|
48
|
+
// Parse global attributes (data-vt-* attributes)
|
|
49
49
|
config.globalAttributes = { ...initialConfig.globalAttributes };
|
|
50
50
|
// NamedNodeMap is not iterable, so use Array.from to iterate over attributes
|
|
51
51
|
for (const attr of Array.from(script.attributes)) {
|
|
52
|
-
if (attr.name.startsWith("
|
|
53
|
-
config.globalAttributes[attr.name.slice(3).replace(/-/g, "_")] =
|
|
54
|
-
attr.value;
|
|
55
|
-
}
|
|
56
|
-
if (attr.name.startsWith("data-tb-")) {
|
|
52
|
+
if (attr.name.startsWith("data-vt-")) {
|
|
57
53
|
config.globalAttributes[attr.name.slice(8).replace(/-/g, "_")] =
|
|
58
54
|
attr.value;
|
|
59
55
|
}
|
package/lib/constants.d.ts
CHANGED
|
@@ -1,12 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Constants
|
|
3
|
+
*
|
|
4
|
+
* Following PostHog's pattern for constant definitions.
|
|
5
|
+
* These are used throughout the SDK for:
|
|
6
|
+
* - Storage keys
|
|
7
|
+
* - Property names
|
|
8
|
+
* - Event names
|
|
9
|
+
* - Configuration defaults
|
|
10
|
+
*/
|
|
11
|
+
/** @deprecated Use DISTINCT_ID instead */
|
|
12
|
+
export declare const PEOPLE_DISTINCT_ID_KEY = "$people_distinct_id";
|
|
13
|
+
/** Current distinct_id */
|
|
14
|
+
export declare const DISTINCT_ID = "distinct_id";
|
|
15
|
+
/** Alias ID for aliasing operations */
|
|
16
|
+
export declare const ALIAS_ID_KEY = "__alias";
|
|
17
|
+
/** Event timers storage key */
|
|
18
|
+
export declare const EVENT_TIMERS_KEY = "__timers";
|
|
19
|
+
/** Session ID storage key */
|
|
20
|
+
export declare const SESSION_ID = "$sesid";
|
|
21
|
+
/** Session storage key (for session manager) */
|
|
22
|
+
export declare const STORAGE_KEY = "__vt_session";
|
|
23
|
+
/** Window ID storage key */
|
|
24
|
+
export declare const WINDOW_ID = "$windowid";
|
|
25
|
+
/** Window ID key (for session storage) */
|
|
26
|
+
export declare const WINDOW_ID_KEY = "__vt_window_id";
|
|
27
|
+
/** Primary window exists key (for tab duplication detection) */
|
|
28
|
+
export declare const PRIMARY_WINDOW_EXISTS_KEY = "__vt_primary_window";
|
|
29
|
+
/** User state (anonymous/identified) */
|
|
30
|
+
export declare const USER_STATE = "$user_state";
|
|
31
|
+
/** User state storage key */
|
|
32
|
+
export declare const USER_STATE_KEY = "__vt_user_state";
|
|
33
|
+
/** Device ID storage key */
|
|
34
|
+
export declare const DEVICE_ID = "$device_id";
|
|
35
|
+
/** Device ID key (for storage) */
|
|
36
|
+
export declare const DEVICE_ID_KEY = "__vt_device_id";
|
|
37
|
+
/** Anonymous ID storage key */
|
|
38
|
+
export declare const ANONYMOUS_ID = "$anonymous_id";
|
|
39
|
+
/** Anonymous ID key (for storage) */
|
|
40
|
+
export declare const ANONYMOUS_ID_KEY = "__vt_anonymous_id";
|
|
41
|
+
/** Distinct ID key (for storage) */
|
|
42
|
+
export declare const DISTINCT_ID_KEY = "__vt_distinct_id";
|
|
43
|
+
/** User properties storage key */
|
|
44
|
+
export declare const USER_PROPERTIES_KEY = "__vt_user_properties";
|
|
45
|
+
/**
|
|
46
|
+
* Persistence methods object
|
|
47
|
+
* Following PostHog's approach for storage/persistence configuration
|
|
48
|
+
*/
|
|
49
|
+
export declare const PERSISTENCE_METHODS: {
|
|
50
|
+
cookie: "cookie";
|
|
51
|
+
localStorage: "localStorage";
|
|
52
|
+
localStoragePlusCookie: "localStorage+cookie";
|
|
53
|
+
sessionStorage: "sessionStorage";
|
|
54
|
+
memory: "memory";
|
|
55
|
+
};
|
|
56
|
+
/** @deprecated Use PERSISTENCE_METHODS instead */
|
|
57
|
+
export declare const STORAGE_METHODS: {
|
|
58
|
+
cookie: "cookie";
|
|
59
|
+
localStorage: "localStorage";
|
|
60
|
+
localStoragePlusCookie: "localStorage+cookie";
|
|
61
|
+
sessionStorage: "sessionStorage";
|
|
62
|
+
memory: "memory";
|
|
63
|
+
};
|
|
64
|
+
/** Enable person processing flag */
|
|
65
|
+
export declare const ENABLE_PERSON_PROCESSING = "$epp";
|
|
66
|
+
/** Initial person info (referrer, URL, UTM params) */
|
|
10
67
|
export declare const INITIAL_PERSON_INFO = "$initial_person_info";
|
|
11
|
-
|
|
68
|
+
/** @deprecated Use INITIAL_PERSON_INFO */
|
|
69
|
+
export declare const INITIAL_CAMPAIGN_PARAMS = "$initial_campaign_params";
|
|
70
|
+
/** @deprecated Use INITIAL_PERSON_INFO */
|
|
71
|
+
export declare const INITIAL_REFERRER_INFO = "$initial_referrer_info";
|
|
72
|
+
/** Stored person properties for feature flags */
|
|
73
|
+
export declare const STORED_PERSON_PROPERTIES_KEY = "$stored_person_properties";
|
|
74
|
+
/** Stored group properties for feature flags */
|
|
75
|
+
export declare const STORED_GROUP_PROPERTIES_KEY = "$stored_group_properties";
|
|
76
|
+
export declare const AUTOCAPTURE_DISABLED_SERVER_SIDE = "$autocapture_disabled_server_side";
|
|
77
|
+
export declare const WEB_VITALS_ENABLED_SERVER_SIDE = "$web_vitals_enabled_server_side";
|
|
78
|
+
export declare const SESSION_RECORDING_ENABLED_SERVER_SIDE = "$session_recording_enabled_server_side";
|
|
79
|
+
/** Pageview event */
|
|
80
|
+
export declare const EVENT_PAGEVIEW = "$pageview";
|
|
81
|
+
/** Pageleave event */
|
|
82
|
+
export declare const EVENT_PAGELEAVE = "$pageleave";
|
|
83
|
+
/** Identify event */
|
|
84
|
+
export declare const EVENT_IDENTIFY = "$identify";
|
|
85
|
+
/** Alias event */
|
|
86
|
+
export declare const EVENT_ALIAS = "$create_alias";
|
|
87
|
+
/** Set person properties event */
|
|
88
|
+
export declare const EVENT_SET = "$set";
|
|
89
|
+
/** Group identify event */
|
|
90
|
+
export declare const EVENT_GROUP_IDENTIFY = "$groupidentify";
|
|
91
|
+
/** Performance event */
|
|
92
|
+
export declare const EVENT_PERFORMANCE = "$performance_event";
|
|
93
|
+
/** Snapshot event (session recording) */
|
|
94
|
+
export declare const EVENT_SNAPSHOT = "$snapshot";
|
|
95
|
+
/** Rate limit warning event */
|
|
96
|
+
export declare const EVENT_RATE_LIMIT_WARNING = "$$client_ingestion_warning";
|
|
97
|
+
/** Process person profile flag */
|
|
98
|
+
export declare const PROP_PROCESS_PERSON_PROFILE = "$process_person_profile";
|
|
99
|
+
/** Is identified flag */
|
|
100
|
+
export declare const PROP_IS_IDENTIFIED = "$is_identified";
|
|
101
|
+
/** Anonymous distinct ID */
|
|
102
|
+
export declare const PROP_ANON_DISTINCT_ID = "$anon_distinct_id";
|
|
103
|
+
/** Session ID property */
|
|
104
|
+
export declare const PROP_SESSION_ID = "$session_id";
|
|
105
|
+
/** Window ID property */
|
|
106
|
+
export declare const PROP_WINDOW_ID = "$window_id";
|
|
107
|
+
/** Current URL */
|
|
108
|
+
export declare const PROP_CURRENT_URL = "$current_url";
|
|
109
|
+
/** Hostname */
|
|
110
|
+
export declare const PROP_HOST = "$host";
|
|
111
|
+
/** Pathname */
|
|
112
|
+
export declare const PROP_PATHNAME = "$pathname";
|
|
113
|
+
/** Referrer URL */
|
|
114
|
+
export declare const PROP_REFERRER = "$referrer";
|
|
115
|
+
/** Referring domain */
|
|
116
|
+
export declare const PROP_REFERRING_DOMAIN = "$referring_domain";
|
|
117
|
+
/** Browser */
|
|
118
|
+
export declare const PROP_BROWSER = "$browser";
|
|
119
|
+
/** Browser version */
|
|
120
|
+
export declare const PROP_BROWSER_VERSION = "$browser_version";
|
|
121
|
+
/** Operating system */
|
|
122
|
+
export declare const PROP_OS = "$os";
|
|
123
|
+
/** OS version */
|
|
124
|
+
export declare const PROP_OS_VERSION = "$os_version";
|
|
125
|
+
/** Device type */
|
|
126
|
+
export declare const PROP_DEVICE_TYPE = "$device_type";
|
|
127
|
+
/** Screen height */
|
|
128
|
+
export declare const PROP_SCREEN_HEIGHT = "$screen_height";
|
|
129
|
+
/** Screen width */
|
|
130
|
+
export declare const PROP_SCREEN_WIDTH = "$screen_width";
|
|
131
|
+
/** Viewport height */
|
|
132
|
+
export declare const PROP_VIEWPORT_HEIGHT = "$viewport_height";
|
|
133
|
+
/** Viewport width */
|
|
134
|
+
export declare const PROP_VIEWPORT_WIDTH = "$viewport_width";
|
|
135
|
+
/** Library name */
|
|
136
|
+
export declare const PROP_LIB = "$lib";
|
|
137
|
+
/** Library version */
|
|
138
|
+
export declare const PROP_LIB_VERSION = "$lib_version";
|
|
139
|
+
export declare const PROP_GEOIP_COUNTRY_CODE = "$geoip_country_code";
|
|
140
|
+
export declare const PROP_GEOIP_COUNTRY_NAME = "$geoip_country_name";
|
|
141
|
+
export declare const PROP_GEOIP_CITY_NAME = "$geoip_city_name";
|
|
142
|
+
export declare const PROP_GEOIP_REGION_NAME = "$geoip_region_name";
|
|
143
|
+
export declare const PROP_GEOIP_CONTINENT_CODE = "$geoip_continent_code";
|
|
144
|
+
export declare const PROP_GEOIP_TIMEZONE = "$geoip_timezone";
|
|
145
|
+
export declare const PROP_GEOIP_LATITUDE = "$geoip_latitude";
|
|
146
|
+
export declare const PROP_GEOIP_LONGITUDE = "$geoip_longitude";
|
|
147
|
+
/** Initial GeoIP properties (set once) */
|
|
148
|
+
export declare const PROP_INITIAL_GEOIP_PREFIX = "$initial_geoip_";
|
|
149
|
+
export declare const UTM_PARAMS: readonly ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gclid", "gad_source", "gbraid", "wbraid", "fbclid", "msclkid", "twclid", "li_fat_id", "mc_cid", "igshid", "ttclid"];
|
|
150
|
+
export type UTMParam = (typeof UTM_PARAMS)[number];
|
|
151
|
+
export declare const PERSISTENCE_RESERVED_PROPERTIES: string[];
|
|
152
|
+
/**
|
|
153
|
+
* Person profiles configuration mode
|
|
154
|
+
* - 'always': Always create person profiles (default)
|
|
155
|
+
* - 'identified_only': Only create profiles when user is identified
|
|
156
|
+
* - 'never': Never create person profiles (events only)
|
|
157
|
+
*/
|
|
158
|
+
export type PersonProfilesMode = "always" | "identified_only" | "never";
|
|
159
|
+
/** Default API host */
|
|
160
|
+
export declare const DEFAULT_API_HOST = "https://api.vtilt.io";
|
|
161
|
+
/** Default flush interval (ms) */
|
|
162
|
+
export declare const DEFAULT_FLUSH_INTERVAL_MS = 5000;
|
|
163
|
+
/** Default batch size */
|
|
164
|
+
export declare const DEFAULT_BATCH_SIZE = 10;
|
|
165
|
+
/** Session timeout (30 minutes in ms) */
|
|
166
|
+
export declare const SESSION_TIMEOUT_MS: number;
|
|
167
|
+
/** Session ID change threshold (ms) */
|
|
168
|
+
export declare const SESSION_CHANGE_THRESHOLD_MS: number;
|
|
169
|
+
/** Maximum event properties size (bytes) */
|
|
170
|
+
export declare const MAX_PROPERTIES_SIZE = 65535;
|
|
171
|
+
/** Maximum property value length */
|
|
172
|
+
export declare const MAX_PROPERTY_VALUE_LENGTH = 8192;
|
|
173
|
+
/** Timezone to country code mapping */
|
|
12
174
|
export declare const TIMEZONES: Record<string, string>;
|