@loamly/tracker 2.1.0 → 2.4.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/README.md +4 -3
- package/dist/index.cjs +1580 -1286
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.mjs +1580 -1286
- package/dist/index.mjs.map +1 -1
- package/dist/loamly.iife.global.js +1578 -1270
- package/dist/loamly.iife.global.js.map +1 -1
- package/dist/loamly.iife.min.global.js +1 -1
- package/dist/loamly.iife.min.global.js.map +1 -1
- package/package.json +1 -1
- package/src/behavioral/form-tracker.ts +107 -1
- package/src/browser.ts +25 -6
- package/src/config.ts +1 -1
- package/src/core.ts +386 -132
- package/src/index.ts +1 -1
- package/src/infrastructure/event-queue.ts +58 -32
- package/src/infrastructure/ping.ts +19 -3
- package/src/types.ts +23 -0
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,8 @@ declare function createAgenticAnalyzer(): AgenticBrowserAnalyzer;
|
|
|
67
67
|
interface LoamlyConfig {
|
|
68
68
|
/** Your Loamly API key (found in dashboard) */
|
|
69
69
|
apiKey?: string;
|
|
70
|
+
/** Workspace ID (required when using public tracker key) */
|
|
71
|
+
workspaceId?: string;
|
|
70
72
|
/** Custom API host (default: https://app.loamly.ai) */
|
|
71
73
|
apiHost?: string;
|
|
72
74
|
/** Enable debug mode for console logging */
|
|
@@ -165,6 +167,22 @@ interface LoamlyTracker {
|
|
|
165
167
|
pageview: (url?: string) => void;
|
|
166
168
|
/** Track a custom event */
|
|
167
169
|
track: (eventName: string, options?: TrackEventOptions) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Track a behavioral event (for secondary modules/plugins)
|
|
172
|
+
*
|
|
173
|
+
* This is the recommended way for secondary tracking modules to send events.
|
|
174
|
+
* It automatically includes workspace_id, visitor_id, session_id, and handles
|
|
175
|
+
* batching, queueing, and retry logic.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```js
|
|
179
|
+
* Loamly.trackBehavioral('outbound_click', {
|
|
180
|
+
* url: 'https://example.com',
|
|
181
|
+
* text: 'Click here'
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
|
|
168
186
|
/** Track a conversion/revenue event */
|
|
169
187
|
conversion: (eventName: string, revenue: number, currency?: string) => void;
|
|
170
188
|
/** Identify a user (for linking sessions) */
|
|
@@ -173,6 +191,8 @@ interface LoamlyTracker {
|
|
|
173
191
|
getSessionId: () => string | null;
|
|
174
192
|
/** Get the current visitor ID */
|
|
175
193
|
getVisitorId: () => string | null;
|
|
194
|
+
/** Get the current workspace ID */
|
|
195
|
+
getWorkspaceId: () => string | null;
|
|
176
196
|
/** Get AI detection result for current page */
|
|
177
197
|
getAIDetection: () => AIDetectionResult | null;
|
|
178
198
|
/** Get navigation timing analysis */
|
|
@@ -214,6 +234,8 @@ interface LoamlyTracker {
|
|
|
214
234
|
declare const loamly: LoamlyTracker & {
|
|
215
235
|
getAgentic: () => AgenticDetectionResult | null;
|
|
216
236
|
reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
|
|
237
|
+
trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
|
|
238
|
+
getWorkspaceId: () => string | null;
|
|
217
239
|
};
|
|
218
240
|
|
|
219
241
|
/**
|
|
@@ -270,7 +292,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
|
|
|
270
292
|
* @license MIT
|
|
271
293
|
* @see https://github.com/loamly/loamly
|
|
272
294
|
*/
|
|
273
|
-
declare const VERSION = "2.
|
|
295
|
+
declare const VERSION = "2.4.0";
|
|
274
296
|
/**
|
|
275
297
|
* Known AI platforms for referrer detection
|
|
276
298
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ declare function createAgenticAnalyzer(): AgenticBrowserAnalyzer;
|
|
|
67
67
|
interface LoamlyConfig {
|
|
68
68
|
/** Your Loamly API key (found in dashboard) */
|
|
69
69
|
apiKey?: string;
|
|
70
|
+
/** Workspace ID (required when using public tracker key) */
|
|
71
|
+
workspaceId?: string;
|
|
70
72
|
/** Custom API host (default: https://app.loamly.ai) */
|
|
71
73
|
apiHost?: string;
|
|
72
74
|
/** Enable debug mode for console logging */
|
|
@@ -165,6 +167,22 @@ interface LoamlyTracker {
|
|
|
165
167
|
pageview: (url?: string) => void;
|
|
166
168
|
/** Track a custom event */
|
|
167
169
|
track: (eventName: string, options?: TrackEventOptions) => void;
|
|
170
|
+
/**
|
|
171
|
+
* Track a behavioral event (for secondary modules/plugins)
|
|
172
|
+
*
|
|
173
|
+
* This is the recommended way for secondary tracking modules to send events.
|
|
174
|
+
* It automatically includes workspace_id, visitor_id, session_id, and handles
|
|
175
|
+
* batching, queueing, and retry logic.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```js
|
|
179
|
+
* Loamly.trackBehavioral('outbound_click', {
|
|
180
|
+
* url: 'https://example.com',
|
|
181
|
+
* text: 'Click here'
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
|
|
168
186
|
/** Track a conversion/revenue event */
|
|
169
187
|
conversion: (eventName: string, revenue: number, currency?: string) => void;
|
|
170
188
|
/** Identify a user (for linking sessions) */
|
|
@@ -173,6 +191,8 @@ interface LoamlyTracker {
|
|
|
173
191
|
getSessionId: () => string | null;
|
|
174
192
|
/** Get the current visitor ID */
|
|
175
193
|
getVisitorId: () => string | null;
|
|
194
|
+
/** Get the current workspace ID */
|
|
195
|
+
getWorkspaceId: () => string | null;
|
|
176
196
|
/** Get AI detection result for current page */
|
|
177
197
|
getAIDetection: () => AIDetectionResult | null;
|
|
178
198
|
/** Get navigation timing analysis */
|
|
@@ -214,6 +234,8 @@ interface LoamlyTracker {
|
|
|
214
234
|
declare const loamly: LoamlyTracker & {
|
|
215
235
|
getAgentic: () => AgenticDetectionResult | null;
|
|
216
236
|
reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
|
|
237
|
+
trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
|
|
238
|
+
getWorkspaceId: () => string | null;
|
|
217
239
|
};
|
|
218
240
|
|
|
219
241
|
/**
|
|
@@ -270,7 +292,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
|
|
|
270
292
|
* @license MIT
|
|
271
293
|
* @see https://github.com/loamly/loamly
|
|
272
294
|
*/
|
|
273
|
-
declare const VERSION = "2.
|
|
295
|
+
declare const VERSION = "2.4.0";
|
|
274
296
|
/**
|
|
275
297
|
* Known AI platforms for referrer detection
|
|
276
298
|
*/
|