@li2/analytics 0.3.0-beta.0 → 0.3.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/auto-events.global.js +1 -1
- package/dist/auto-events.js +1 -1
- package/dist/auto-events.mjs +1 -1
- package/dist/chunk-FF6VDEL5.mjs +1 -0
- package/dist/chunk-LZDMBCUK.mjs +1 -0
- package/dist/chunk-MURA7RU5.mjs +1 -1
- package/dist/click-tracker/index.d.mts +52 -0
- package/dist/click-tracker/index.d.ts +52 -0
- package/dist/click-tracker/index.global.js +1 -0
- package/dist/click-tracker/index.js +1 -0
- package/dist/click-tracker/index.mjs +1 -0
- package/dist/element-resolver-BnZ_ItHT.d.mts +22 -0
- package/dist/element-resolver-BnZ_ItHT.d.ts +22 -0
- package/dist/{index-DEfkJIjF.d.mts → index-B3dzYzIM.d.mts} +8 -0
- package/dist/{index-DEfkJIjF.d.ts → index-B3dzYzIM.d.ts} +8 -0
- package/dist/index.d.mts +102 -3
- package/dist/index.d.ts +102 -3
- package/dist/index.global.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/outbound.global.js +1 -1
- package/dist/outbound.js +1 -1
- package/dist/outbound.mjs +1 -1
- package/dist/pageview/index.d.mts +1 -1
- package/dist/pageview/index.d.ts +1 -1
- package/dist/pageview/index.global.js +1 -1
- package/dist/pageview/index.js +1 -1
- package/dist/pageview/index.mjs +1 -1
- package/dist/toolbar/index.d.mts +39 -0
- package/dist/toolbar/index.d.ts +39 -0
- package/dist/toolbar/index.global.js +113 -0
- package/dist/toolbar/index.js +113 -0
- package/dist/toolbar/index.mjs +113 -0
- package/package.json +22 -13
- package/dist/chunk-6RUMMSEZ.mjs +0 -1
- package/dist/click-triggers.d.mts +0 -2
- package/dist/click-triggers.d.ts +0 -2
- package/dist/click-triggers.global.js +0 -1
- package/dist/click-triggers.js +0 -1
- package/dist/click-triggers.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
|
-
import { P as PageviewTracker } from './index-
|
|
2
|
-
export { c as PageviewBatchPayload, a as PageviewConfig, b as PageviewEvent } from './index-
|
|
1
|
+
import { P as PageviewTracker } from './index-B3dzYzIM.js';
|
|
2
|
+
export { c as PageviewBatchPayload, a as PageviewConfig, b as PageviewEvent } from './index-B3dzYzIM.js';
|
|
3
3
|
export { AnalyticsSettings, AutoEvent, ConditionOperator, ConditionType, EventAction, EventActionType, EventTrigger, TriggerCondition, TriggerType } from './auto-events.js';
|
|
4
|
+
export { ClickTrackerConfig } from './click-tracker/index.js';
|
|
5
|
+
export { E as ElementInfo } from './element-resolver-BnZ_ItHT.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Batch sender for click interaction events.
|
|
9
|
+
* Same pattern as pageview BatchSender but sends to /api/v1/track/interaction.
|
|
10
|
+
*/
|
|
11
|
+
interface InteractionEvent {
|
|
12
|
+
/** Client-generated session ID */
|
|
13
|
+
session_id: string;
|
|
14
|
+
/** Persistent visitor ID */
|
|
15
|
+
visitor_id: string;
|
|
16
|
+
/** Li2 click ID if visitor came from short link */
|
|
17
|
+
li2_cid: string | null;
|
|
18
|
+
/** Full page URL */
|
|
19
|
+
page_url: string;
|
|
20
|
+
/** URL path only */
|
|
21
|
+
page_path: string;
|
|
22
|
+
/** Absolute X position (scroll-adjusted unless fixed) */
|
|
23
|
+
x: number;
|
|
24
|
+
/** Absolute Y position (scroll-adjusted unless fixed) */
|
|
25
|
+
y: number;
|
|
26
|
+
/** Whether clicked element has position: fixed/sticky */
|
|
27
|
+
target_fixed: boolean;
|
|
28
|
+
/** Browser viewport dimensions */
|
|
29
|
+
viewport_width: number;
|
|
30
|
+
viewport_height: number;
|
|
31
|
+
/** Total scrollable page height */
|
|
32
|
+
page_height: number;
|
|
33
|
+
/** Scroll Y at click time */
|
|
34
|
+
scroll_y: number;
|
|
35
|
+
/** Element tag name (lowercase) */
|
|
36
|
+
element_tag: string;
|
|
37
|
+
/** Element innerText (truncated to 256 chars) */
|
|
38
|
+
element_text: string;
|
|
39
|
+
/** href attribute if link element */
|
|
40
|
+
element_href: string | null;
|
|
41
|
+
/** className (truncated to 512 chars) */
|
|
42
|
+
element_class: string;
|
|
43
|
+
/** id attribute */
|
|
44
|
+
element_id: string | null;
|
|
45
|
+
/** Stable CSS selector path */
|
|
46
|
+
selector_path: string;
|
|
47
|
+
/** Interaction type (click, scroll, etc.) */
|
|
48
|
+
interaction_type: string;
|
|
49
|
+
/** Unix timestamp in milliseconds */
|
|
50
|
+
timestamp: number;
|
|
51
|
+
}
|
|
52
|
+
interface InteractionBatchPayload {
|
|
53
|
+
interactions: InteractionEvent[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Coordinate calculation for click capture.
|
|
58
|
+
* Handles fixed/sticky element positioning and scroll adjustment.
|
|
59
|
+
*/
|
|
60
|
+
interface ClickCoordinates {
|
|
61
|
+
/** Absolute X position (scroll-adjusted unless fixed) */
|
|
62
|
+
x: number;
|
|
63
|
+
/** Absolute Y position (scroll-adjusted unless fixed) */
|
|
64
|
+
y: number;
|
|
65
|
+
/** Current scroll Y at click time */
|
|
66
|
+
scrollY: number;
|
|
67
|
+
/** Total scrollable page height */
|
|
68
|
+
pageHeight: number;
|
|
69
|
+
}
|
|
4
70
|
|
|
5
71
|
/**
|
|
6
72
|
* Li2 Analytics SDK
|
|
@@ -145,6 +211,7 @@ declare class Li2Analytics {
|
|
|
145
211
|
private clickId;
|
|
146
212
|
private cookieOptions;
|
|
147
213
|
private autoEventTracker;
|
|
214
|
+
private clickTracker;
|
|
148
215
|
pageview: PageviewTracker | null;
|
|
149
216
|
constructor(config?: Li2Config);
|
|
150
217
|
private log;
|
|
@@ -172,6 +239,23 @@ declare class Li2Analytics {
|
|
|
172
239
|
cookieDomain?: string;
|
|
173
240
|
cookiePath?: string;
|
|
174
241
|
}): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Initialize click tracking from data-attributes.
|
|
244
|
+
* Uses dynamic import to lazy-load the click-tracker module only when enabled.
|
|
245
|
+
* @internal Called from auto-init block - not part of public API
|
|
246
|
+
*/
|
|
247
|
+
initClickTracking(clickConfig: Record<string, string>): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Enable click tracking programmatically (for users not using data-attributes)
|
|
250
|
+
*/
|
|
251
|
+
enableClickTracking(options?: {
|
|
252
|
+
batchInterval?: number;
|
|
253
|
+
excludeSelector?: string;
|
|
254
|
+
sessionTimeout?: number;
|
|
255
|
+
cookieLessMode?: boolean;
|
|
256
|
+
cookieDomain?: string;
|
|
257
|
+
cookiePath?: string;
|
|
258
|
+
}): Promise<void>;
|
|
175
259
|
/**
|
|
176
260
|
* Manually track a pageview (convenience method)
|
|
177
261
|
*/
|
|
@@ -180,6 +264,13 @@ declare class Li2Analytics {
|
|
|
180
264
|
pageTitle?: string;
|
|
181
265
|
customData?: Record<string, unknown>;
|
|
182
266
|
}): void;
|
|
267
|
+
/**
|
|
268
|
+
* Track a named event (sent through the pageview pipeline with event_name set)
|
|
269
|
+
* Auto-initializes PageviewTracker if not already running.
|
|
270
|
+
*/
|
|
271
|
+
trackEvent(eventName: string, options?: {
|
|
272
|
+
category?: string;
|
|
273
|
+
}): Promise<void>;
|
|
183
274
|
/**
|
|
184
275
|
* Set cookie options for customizing cookie behavior
|
|
185
276
|
* If a clickId already exists, the cookie will be re-set with the new options
|
|
@@ -310,6 +401,13 @@ declare function trackPageview(options?: {
|
|
|
310
401
|
pageTitle?: string;
|
|
311
402
|
customData?: Record<string, unknown>;
|
|
312
403
|
}): void;
|
|
404
|
+
/**
|
|
405
|
+
* Track a named event
|
|
406
|
+
* Convenience function that uses the singleton instance
|
|
407
|
+
*/
|
|
408
|
+
declare function trackEvent(eventName: string, options?: {
|
|
409
|
+
category?: string;
|
|
410
|
+
}): Promise<void>;
|
|
313
411
|
|
|
314
412
|
/**
|
|
315
413
|
* Initialize the server-side Li2 Analytics SDK
|
|
@@ -321,6 +419,7 @@ declare const _default: {
|
|
|
321
419
|
getInstance: typeof getInstance;
|
|
322
420
|
trackLead: typeof trackLead;
|
|
323
421
|
trackSale: typeof trackSale;
|
|
422
|
+
trackEvent: typeof trackEvent;
|
|
324
423
|
identify: typeof identify;
|
|
325
424
|
isTrackingAvailable: typeof isTrackingAvailable;
|
|
326
425
|
getClickId: typeof getClickId;
|
|
@@ -328,4 +427,4 @@ declare const _default: {
|
|
|
328
427
|
initServer: typeof initServer;
|
|
329
428
|
};
|
|
330
429
|
|
|
331
|
-
export { type CookieOptions, Li2Analytics, type Li2Config, Li2ServerAnalytics, type Li2ServerConfig, type ServerTrackLeadParams, type ServerTrackSaleParams, type TrackLeadParams, type TrackLeadResponse, type TrackSaleParams, type TrackSaleResponse, _default as default, getClickId, getInstance, identify, init, initServer, isTrackingAvailable, trackLead, trackPageview, trackSale };
|
|
430
|
+
export { type ClickCoordinates, type CookieOptions, type InteractionBatchPayload, type InteractionEvent, Li2Analytics, type Li2Config, Li2ServerAnalytics, type Li2ServerConfig, type ServerTrackLeadParams, type ServerTrackSaleParams, type TrackLeadParams, type TrackLeadResponse, type TrackSaleParams, type TrackSaleResponse, _default as default, getClickId, getInstance, identify, init, initServer, isTrackingAvailable, trackEvent, trackLead, trackPageview, trackSale };
|