@loamly/tracker 2.1.1 → 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/dist/index.d.mts CHANGED
@@ -167,6 +167,22 @@ interface LoamlyTracker {
167
167
  pageview: (url?: string) => void;
168
168
  /** Track a custom event */
169
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;
170
186
  /** Track a conversion/revenue event */
171
187
  conversion: (eventName: string, revenue: number, currency?: string) => void;
172
188
  /** Identify a user (for linking sessions) */
@@ -175,6 +191,8 @@ interface LoamlyTracker {
175
191
  getSessionId: () => string | null;
176
192
  /** Get the current visitor ID */
177
193
  getVisitorId: () => string | null;
194
+ /** Get the current workspace ID */
195
+ getWorkspaceId: () => string | null;
178
196
  /** Get AI detection result for current page */
179
197
  getAIDetection: () => AIDetectionResult | null;
180
198
  /** Get navigation timing analysis */
@@ -216,6 +234,8 @@ interface LoamlyTracker {
216
234
  declare const loamly: LoamlyTracker & {
217
235
  getAgentic: () => AgenticDetectionResult | null;
218
236
  reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
237
+ trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
238
+ getWorkspaceId: () => string | null;
219
239
  };
220
240
 
221
241
  /**
@@ -272,7 +292,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
272
292
  * @license MIT
273
293
  * @see https://github.com/loamly/loamly
274
294
  */
275
- declare const VERSION = "2.1.1";
295
+ declare const VERSION = "2.4.0";
276
296
  /**
277
297
  * Known AI platforms for referrer detection
278
298
  */
package/dist/index.d.ts CHANGED
@@ -167,6 +167,22 @@ interface LoamlyTracker {
167
167
  pageview: (url?: string) => void;
168
168
  /** Track a custom event */
169
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;
170
186
  /** Track a conversion/revenue event */
171
187
  conversion: (eventName: string, revenue: number, currency?: string) => void;
172
188
  /** Identify a user (for linking sessions) */
@@ -175,6 +191,8 @@ interface LoamlyTracker {
175
191
  getSessionId: () => string | null;
176
192
  /** Get the current visitor ID */
177
193
  getVisitorId: () => string | null;
194
+ /** Get the current workspace ID */
195
+ getWorkspaceId: () => string | null;
178
196
  /** Get AI detection result for current page */
179
197
  getAIDetection: () => AIDetectionResult | null;
180
198
  /** Get navigation timing analysis */
@@ -216,6 +234,8 @@ interface LoamlyTracker {
216
234
  declare const loamly: LoamlyTracker & {
217
235
  getAgentic: () => AgenticDetectionResult | null;
218
236
  reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
237
+ trackBehavioral: (eventType: string, eventData: Record<string, unknown>) => void;
238
+ getWorkspaceId: () => string | null;
219
239
  };
220
240
 
221
241
  /**
@@ -272,7 +292,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
272
292
  * @license MIT
273
293
  * @see https://github.com/loamly/loamly
274
294
  */
275
- declare const VERSION = "2.1.1";
295
+ declare const VERSION = "2.4.0";
276
296
  /**
277
297
  * Known AI platforms for referrer detection
278
298
  */