@metodokorexmk/tracking 1.1.0 → 1.2.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.cjs +42 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +208 -210
- package/dist/index.d.ts +208 -210
- package/dist/index.js +42 -38
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +27 -27
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +54 -54
- package/dist/react/index.d.ts +54 -54
- package/dist/react/index.js +27 -27
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* LandingTracker configuration (session orchestrator).
|
|
3
3
|
*/
|
|
4
4
|
interface LandingTrackerConfig {
|
|
5
|
-
/**
|
|
5
|
+
/** Landing page path (e.g., '/kin', '/racha') */
|
|
6
6
|
pagePath: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Human-readable landing page name (e.g., 'Kin Landing Page') */
|
|
8
8
|
pageName: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Google Tag Manager container ID (optional) */
|
|
10
10
|
gtmId?: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Enable scroll tracking (milestones 25/50/75/100%). Default: true */
|
|
12
12
|
enableScrollTracking?: boolean;
|
|
13
|
-
/**
|
|
13
|
+
/** Enable automatic CTA click tracking. Default: true */
|
|
14
14
|
enableCTATracking?: boolean;
|
|
15
|
-
/**
|
|
15
|
+
/** Enable page dwell time tracking. Default: true */
|
|
16
16
|
enableTimeTracking?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Enable per-section dwell time via IntersectionObserver. Default: true */
|
|
18
18
|
enableSectionTracking?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** Enable automatic form interaction tracking. Default: true */
|
|
20
20
|
enableFormTracking?: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/** Enable click heatmap (X/Y coordinates). Default: false */
|
|
22
22
|
enableHeatmap?: boolean;
|
|
23
|
-
/**
|
|
23
|
+
/** Custom event suffix (e.g., '_kin' produces 'cta_click_kin'). Default: '' */
|
|
24
24
|
eventSuffix?: string;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Video playback statistics.
|
|
28
|
+
* Shared across all adapters (Wistia, Voomly, HTML5).
|
|
29
29
|
*/
|
|
30
30
|
interface VideoStats {
|
|
31
|
-
/**
|
|
31
|
+
/** Total time watched in seconds */
|
|
32
32
|
timeWatched: number;
|
|
33
|
-
/**
|
|
33
|
+
/** Whether the video was completed (>=90-95%) */
|
|
34
34
|
completed: boolean;
|
|
35
|
-
/** Timestamp
|
|
35
|
+
/** Timestamp of the last stats update */
|
|
36
36
|
lastUpdate: number;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Options for React video tracking hooks.
|
|
40
40
|
*/
|
|
41
41
|
interface UseVideoTrackingOptions {
|
|
42
|
-
/**
|
|
42
|
+
/** Unique video identifier */
|
|
43
43
|
videoId: string;
|
|
44
|
-
/**
|
|
44
|
+
/** Reference to the HTML <video> element (HTML5 only) */
|
|
45
45
|
videoElement?: HTMLVideoElement | null;
|
|
46
|
-
/** Callback
|
|
46
|
+
/** Callback when the video completes */
|
|
47
47
|
onComplete?: () => void;
|
|
48
|
-
/** Callback
|
|
48
|
+
/** Callback on progress milestones (25, 50, 75) */
|
|
49
49
|
onProgress?: (percentage: number) => void;
|
|
50
50
|
}
|
|
51
51
|
declare global {
|
|
@@ -60,9 +60,9 @@ declare global {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* LandingTracker —
|
|
64
|
-
*
|
|
65
|
-
* form auto-tracking
|
|
63
|
+
* LandingTracker — Full session orchestrator.
|
|
64
|
+
* Initializes and manages scroll tracking, click heatmap, section dwell time,
|
|
65
|
+
* form auto-tracking, and session start/end.
|
|
66
66
|
* Framework-agnostic.
|
|
67
67
|
*/
|
|
68
68
|
|
|
@@ -76,30 +76,30 @@ declare class LandingTracker {
|
|
|
76
76
|
private observers;
|
|
77
77
|
private listeners;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Initializes landing page tracking with the given configuration.
|
|
80
80
|
*/
|
|
81
81
|
init(config: LandingTrackerConfig): void;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Destroys the tracker and cleans up all observers and listeners.
|
|
84
84
|
*/
|
|
85
85
|
destroy(): void;
|
|
86
|
-
/**
|
|
86
|
+
/** Track a CTA click */
|
|
87
87
|
trackCTAClick(buttonName: string, section: string, additionalData?: Record<string, unknown>): void;
|
|
88
|
-
/**
|
|
88
|
+
/** Track a conversion */
|
|
89
89
|
trackConversion(type: string, value?: number, additionalData?: Record<string, unknown>): void;
|
|
90
|
-
/**
|
|
90
|
+
/** Track FAQ expansion */
|
|
91
91
|
trackFAQExpand(question: string, index: number): void;
|
|
92
|
-
/**
|
|
92
|
+
/** Track social link click */
|
|
93
93
|
trackSocialClick(platform: string, action: string): void;
|
|
94
|
-
/**
|
|
94
|
+
/** Track image click */
|
|
95
95
|
trackImageClick(imageName: string, section: string): void;
|
|
96
|
-
/**
|
|
96
|
+
/** Track scroll to a section */
|
|
97
97
|
trackScrollTo(section: string): void;
|
|
98
|
-
/**
|
|
98
|
+
/** Track content share */
|
|
99
99
|
trackShare(platform: string, content: string): void;
|
|
100
|
-
/**
|
|
100
|
+
/** Track file download */
|
|
101
101
|
trackDownload(fileName: string, fileType: string): void;
|
|
102
|
-
/**
|
|
102
|
+
/** Get current session data */
|
|
103
103
|
getSessionData(): {
|
|
104
104
|
duration: number;
|
|
105
105
|
clicks: number;
|
|
@@ -120,13 +120,13 @@ declare class LandingTracker {
|
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* React Hook: useLandingPageTracking
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* Initializes full landing page tracking.
|
|
124
|
+
* React wrapper for the framework-agnostic LandingTracker.
|
|
125
125
|
*/
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Hook
|
|
129
|
-
*
|
|
128
|
+
* Hook to initialize full landing page tracking.
|
|
129
|
+
* Creates a LandingTracker, initializes it, and destroys it on unmount.
|
|
130
130
|
*
|
|
131
131
|
* @example
|
|
132
132
|
* ```tsx
|
|
@@ -137,8 +137,8 @@ declare class LandingTracker {
|
|
|
137
137
|
* gtmId: 'GTM-5GMQNFMN',
|
|
138
138
|
* })
|
|
139
139
|
*
|
|
140
|
-
* //
|
|
141
|
-
* const handleClick = () => tracker?.trackCTAClick('
|
|
140
|
+
* // Use tracker for manual events
|
|
141
|
+
* const handleClick = () => tracker?.trackCTAClick('Join', 'hero')
|
|
142
142
|
* }
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
@@ -146,21 +146,21 @@ declare function useLandingPageTracking(config: LandingTrackerConfig): LandingTr
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* React Hooks: useVideoTracking, useWistiaVideoTracking
|
|
149
|
-
* Hooks
|
|
149
|
+
* Hooks for integrating video tracking in React components.
|
|
150
150
|
*/
|
|
151
151
|
|
|
152
152
|
interface VideoTrackingReturn {
|
|
153
|
-
/**
|
|
153
|
+
/** Progress percentage (0-100) */
|
|
154
154
|
progress: number;
|
|
155
|
-
/**
|
|
155
|
+
/** Whether the video is currently playing */
|
|
156
156
|
isPlaying: boolean;
|
|
157
|
-
/**
|
|
157
|
+
/** Current playback time in seconds */
|
|
158
158
|
currentTime: number;
|
|
159
|
-
/**
|
|
159
|
+
/** Total duration in seconds */
|
|
160
160
|
duration: number;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Hook
|
|
163
|
+
* Hook for tracking a native HTML5 <video> element.
|
|
164
164
|
*
|
|
165
165
|
* @example
|
|
166
166
|
* ```tsx
|
|
@@ -169,8 +169,8 @@ interface VideoTrackingReturn {
|
|
|
169
169
|
* const { progress, isPlaying } = useVideoTracking({
|
|
170
170
|
* videoId: 'hero-video',
|
|
171
171
|
* videoElement: videoRef.current,
|
|
172
|
-
* onComplete: () => console.log('Video
|
|
173
|
-
* onProgress: (pct) => console.log(`
|
|
172
|
+
* onComplete: () => console.log('Video completed'),
|
|
173
|
+
* onProgress: (pct) => console.log(`Progress: ${pct}%`),
|
|
174
174
|
* })
|
|
175
175
|
*
|
|
176
176
|
* return <video ref={videoRef} src="/video.mp4" />
|
|
@@ -179,20 +179,20 @@ interface VideoTrackingReturn {
|
|
|
179
179
|
*/
|
|
180
180
|
declare function useVideoTracking({ videoId, videoElement, onComplete, onProgress }: UseVideoTrackingOptions): VideoTrackingReturn;
|
|
181
181
|
interface WistiaTrackingReturn {
|
|
182
|
-
/**
|
|
182
|
+
/** Current video stats */
|
|
183
183
|
stats: VideoStats;
|
|
184
|
-
/**
|
|
184
|
+
/** Whether the video was completed */
|
|
185
185
|
isCompleted: boolean;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Hook
|
|
189
|
-
*
|
|
188
|
+
* Hook for tracking a Wistia video.
|
|
189
|
+
* Polls window._wq until the Wistia SDK is ready.
|
|
190
190
|
*
|
|
191
191
|
* @example
|
|
192
192
|
* ```tsx
|
|
193
193
|
* function WistiaPlayer({ mediaId }: { mediaId: string }) {
|
|
194
194
|
* const { stats, isCompleted } = useWistiaVideoTracking(mediaId)
|
|
195
|
-
* return <div>
|
|
195
|
+
* return <div>Watched: {stats.timeWatched}s {isCompleted && '✅'}</div>
|
|
196
196
|
* }
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* LandingTracker configuration (session orchestrator).
|
|
3
3
|
*/
|
|
4
4
|
interface LandingTrackerConfig {
|
|
5
|
-
/**
|
|
5
|
+
/** Landing page path (e.g., '/kin', '/racha') */
|
|
6
6
|
pagePath: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Human-readable landing page name (e.g., 'Kin Landing Page') */
|
|
8
8
|
pageName: string;
|
|
9
|
-
/**
|
|
9
|
+
/** Google Tag Manager container ID (optional) */
|
|
10
10
|
gtmId?: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Enable scroll tracking (milestones 25/50/75/100%). Default: true */
|
|
12
12
|
enableScrollTracking?: boolean;
|
|
13
|
-
/**
|
|
13
|
+
/** Enable automatic CTA click tracking. Default: true */
|
|
14
14
|
enableCTATracking?: boolean;
|
|
15
|
-
/**
|
|
15
|
+
/** Enable page dwell time tracking. Default: true */
|
|
16
16
|
enableTimeTracking?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Enable per-section dwell time via IntersectionObserver. Default: true */
|
|
18
18
|
enableSectionTracking?: boolean;
|
|
19
|
-
/**
|
|
19
|
+
/** Enable automatic form interaction tracking. Default: true */
|
|
20
20
|
enableFormTracking?: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/** Enable click heatmap (X/Y coordinates). Default: false */
|
|
22
22
|
enableHeatmap?: boolean;
|
|
23
|
-
/**
|
|
23
|
+
/** Custom event suffix (e.g., '_kin' produces 'cta_click_kin'). Default: '' */
|
|
24
24
|
eventSuffix?: string;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Video playback statistics.
|
|
28
|
+
* Shared across all adapters (Wistia, Voomly, HTML5).
|
|
29
29
|
*/
|
|
30
30
|
interface VideoStats {
|
|
31
|
-
/**
|
|
31
|
+
/** Total time watched in seconds */
|
|
32
32
|
timeWatched: number;
|
|
33
|
-
/**
|
|
33
|
+
/** Whether the video was completed (>=90-95%) */
|
|
34
34
|
completed: boolean;
|
|
35
|
-
/** Timestamp
|
|
35
|
+
/** Timestamp of the last stats update */
|
|
36
36
|
lastUpdate: number;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Options for React video tracking hooks.
|
|
40
40
|
*/
|
|
41
41
|
interface UseVideoTrackingOptions {
|
|
42
|
-
/**
|
|
42
|
+
/** Unique video identifier */
|
|
43
43
|
videoId: string;
|
|
44
|
-
/**
|
|
44
|
+
/** Reference to the HTML <video> element (HTML5 only) */
|
|
45
45
|
videoElement?: HTMLVideoElement | null;
|
|
46
|
-
/** Callback
|
|
46
|
+
/** Callback when the video completes */
|
|
47
47
|
onComplete?: () => void;
|
|
48
|
-
/** Callback
|
|
48
|
+
/** Callback on progress milestones (25, 50, 75) */
|
|
49
49
|
onProgress?: (percentage: number) => void;
|
|
50
50
|
}
|
|
51
51
|
declare global {
|
|
@@ -60,9 +60,9 @@ declare global {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* LandingTracker —
|
|
64
|
-
*
|
|
65
|
-
* form auto-tracking
|
|
63
|
+
* LandingTracker — Full session orchestrator.
|
|
64
|
+
* Initializes and manages scroll tracking, click heatmap, section dwell time,
|
|
65
|
+
* form auto-tracking, and session start/end.
|
|
66
66
|
* Framework-agnostic.
|
|
67
67
|
*/
|
|
68
68
|
|
|
@@ -76,30 +76,30 @@ declare class LandingTracker {
|
|
|
76
76
|
private observers;
|
|
77
77
|
private listeners;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Initializes landing page tracking with the given configuration.
|
|
80
80
|
*/
|
|
81
81
|
init(config: LandingTrackerConfig): void;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Destroys the tracker and cleans up all observers and listeners.
|
|
84
84
|
*/
|
|
85
85
|
destroy(): void;
|
|
86
|
-
/**
|
|
86
|
+
/** Track a CTA click */
|
|
87
87
|
trackCTAClick(buttonName: string, section: string, additionalData?: Record<string, unknown>): void;
|
|
88
|
-
/**
|
|
88
|
+
/** Track a conversion */
|
|
89
89
|
trackConversion(type: string, value?: number, additionalData?: Record<string, unknown>): void;
|
|
90
|
-
/**
|
|
90
|
+
/** Track FAQ expansion */
|
|
91
91
|
trackFAQExpand(question: string, index: number): void;
|
|
92
|
-
/**
|
|
92
|
+
/** Track social link click */
|
|
93
93
|
trackSocialClick(platform: string, action: string): void;
|
|
94
|
-
/**
|
|
94
|
+
/** Track image click */
|
|
95
95
|
trackImageClick(imageName: string, section: string): void;
|
|
96
|
-
/**
|
|
96
|
+
/** Track scroll to a section */
|
|
97
97
|
trackScrollTo(section: string): void;
|
|
98
|
-
/**
|
|
98
|
+
/** Track content share */
|
|
99
99
|
trackShare(platform: string, content: string): void;
|
|
100
|
-
/**
|
|
100
|
+
/** Track file download */
|
|
101
101
|
trackDownload(fileName: string, fileType: string): void;
|
|
102
|
-
/**
|
|
102
|
+
/** Get current session data */
|
|
103
103
|
getSessionData(): {
|
|
104
104
|
duration: number;
|
|
105
105
|
clicks: number;
|
|
@@ -120,13 +120,13 @@ declare class LandingTracker {
|
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* React Hook: useLandingPageTracking
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* Initializes full landing page tracking.
|
|
124
|
+
* React wrapper for the framework-agnostic LandingTracker.
|
|
125
125
|
*/
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* Hook
|
|
129
|
-
*
|
|
128
|
+
* Hook to initialize full landing page tracking.
|
|
129
|
+
* Creates a LandingTracker, initializes it, and destroys it on unmount.
|
|
130
130
|
*
|
|
131
131
|
* @example
|
|
132
132
|
* ```tsx
|
|
@@ -137,8 +137,8 @@ declare class LandingTracker {
|
|
|
137
137
|
* gtmId: 'GTM-5GMQNFMN',
|
|
138
138
|
* })
|
|
139
139
|
*
|
|
140
|
-
* //
|
|
141
|
-
* const handleClick = () => tracker?.trackCTAClick('
|
|
140
|
+
* // Use tracker for manual events
|
|
141
|
+
* const handleClick = () => tracker?.trackCTAClick('Join', 'hero')
|
|
142
142
|
* }
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
@@ -146,21 +146,21 @@ declare function useLandingPageTracking(config: LandingTrackerConfig): LandingTr
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* React Hooks: useVideoTracking, useWistiaVideoTracking
|
|
149
|
-
* Hooks
|
|
149
|
+
* Hooks for integrating video tracking in React components.
|
|
150
150
|
*/
|
|
151
151
|
|
|
152
152
|
interface VideoTrackingReturn {
|
|
153
|
-
/**
|
|
153
|
+
/** Progress percentage (0-100) */
|
|
154
154
|
progress: number;
|
|
155
|
-
/**
|
|
155
|
+
/** Whether the video is currently playing */
|
|
156
156
|
isPlaying: boolean;
|
|
157
|
-
/**
|
|
157
|
+
/** Current playback time in seconds */
|
|
158
158
|
currentTime: number;
|
|
159
|
-
/**
|
|
159
|
+
/** Total duration in seconds */
|
|
160
160
|
duration: number;
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
|
-
* Hook
|
|
163
|
+
* Hook for tracking a native HTML5 <video> element.
|
|
164
164
|
*
|
|
165
165
|
* @example
|
|
166
166
|
* ```tsx
|
|
@@ -169,8 +169,8 @@ interface VideoTrackingReturn {
|
|
|
169
169
|
* const { progress, isPlaying } = useVideoTracking({
|
|
170
170
|
* videoId: 'hero-video',
|
|
171
171
|
* videoElement: videoRef.current,
|
|
172
|
-
* onComplete: () => console.log('Video
|
|
173
|
-
* onProgress: (pct) => console.log(`
|
|
172
|
+
* onComplete: () => console.log('Video completed'),
|
|
173
|
+
* onProgress: (pct) => console.log(`Progress: ${pct}%`),
|
|
174
174
|
* })
|
|
175
175
|
*
|
|
176
176
|
* return <video ref={videoRef} src="/video.mp4" />
|
|
@@ -179,20 +179,20 @@ interface VideoTrackingReturn {
|
|
|
179
179
|
*/
|
|
180
180
|
declare function useVideoTracking({ videoId, videoElement, onComplete, onProgress }: UseVideoTrackingOptions): VideoTrackingReturn;
|
|
181
181
|
interface WistiaTrackingReturn {
|
|
182
|
-
/**
|
|
182
|
+
/** Current video stats */
|
|
183
183
|
stats: VideoStats;
|
|
184
|
-
/**
|
|
184
|
+
/** Whether the video was completed */
|
|
185
185
|
isCompleted: boolean;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Hook
|
|
189
|
-
*
|
|
188
|
+
* Hook for tracking a Wistia video.
|
|
189
|
+
* Polls window._wq until the Wistia SDK is ready.
|
|
190
190
|
*
|
|
191
191
|
* @example
|
|
192
192
|
* ```tsx
|
|
193
193
|
* function WistiaPlayer({ mediaId }: { mediaId: string }) {
|
|
194
194
|
* const { stats, isCompleted } = useWistiaVideoTracking(mediaId)
|
|
195
|
-
* return <div>
|
|
195
|
+
* return <div>Watched: {stats.timeWatched}s {isCompleted && '✅'}</div>
|
|
196
196
|
* }
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
package/dist/react/index.js
CHANGED
|
@@ -221,7 +221,7 @@ var LandingTracker = class {
|
|
|
221
221
|
this.listeners = [];
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Initializes landing page tracking with the given configuration.
|
|
225
225
|
*/
|
|
226
226
|
init(config) {
|
|
227
227
|
if (typeof window === "undefined") return;
|
|
@@ -257,7 +257,7 @@ var LandingTracker = class {
|
|
|
257
257
|
this.trackSessionStart();
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
260
|
-
*
|
|
260
|
+
* Destroys the tracker and cleans up all observers and listeners.
|
|
261
261
|
*/
|
|
262
262
|
destroy() {
|
|
263
263
|
this.observers.forEach((obs) => obs.disconnect());
|
|
@@ -273,43 +273,43 @@ var LandingTracker = class {
|
|
|
273
273
|
this.sectionTimers.clear();
|
|
274
274
|
}
|
|
275
275
|
// ====================================
|
|
276
|
-
//
|
|
276
|
+
// PUBLIC TRACKING METHODS
|
|
277
277
|
// ====================================
|
|
278
|
-
/**
|
|
278
|
+
/** Track a CTA click */
|
|
279
279
|
trackCTAClick(buttonName, section, additionalData) {
|
|
280
280
|
trackCTAClick(buttonName, section, additionalData);
|
|
281
281
|
this.pushGTMEvent("cta_click", { button_text: buttonName, section });
|
|
282
282
|
}
|
|
283
|
-
/**
|
|
283
|
+
/** Track a conversion */
|
|
284
284
|
trackConversion(type, value, additionalData) {
|
|
285
285
|
trackEvent("Conversion", type, void 0, value, additionalData);
|
|
286
286
|
this.pushGTMEvent("conversion", { conversion_type: type, value });
|
|
287
287
|
}
|
|
288
|
-
/**
|
|
288
|
+
/** Track FAQ expansion */
|
|
289
289
|
trackFAQExpand(question, index) {
|
|
290
290
|
trackEvent("FAQ", "expand", question, index);
|
|
291
291
|
}
|
|
292
|
-
/**
|
|
292
|
+
/** Track social link click */
|
|
293
293
|
trackSocialClick(platform, action) {
|
|
294
294
|
trackEvent("Social", "click", platform, void 0, { social_action: action });
|
|
295
295
|
}
|
|
296
|
-
/**
|
|
296
|
+
/** Track image click */
|
|
297
297
|
trackImageClick(imageName, section) {
|
|
298
298
|
trackEvent("Engagement", "image_click", imageName, void 0, { section });
|
|
299
299
|
}
|
|
300
|
-
/**
|
|
300
|
+
/** Track scroll to a section */
|
|
301
301
|
trackScrollTo(section) {
|
|
302
302
|
trackEvent("Navigation", "scroll_to", section);
|
|
303
303
|
}
|
|
304
|
-
/**
|
|
304
|
+
/** Track content share */
|
|
305
305
|
trackShare(platform, content) {
|
|
306
306
|
trackEvent("Share", "click", platform, void 0, { share_content: content });
|
|
307
307
|
}
|
|
308
|
-
/**
|
|
308
|
+
/** Track file download */
|
|
309
309
|
trackDownload(fileName, fileType) {
|
|
310
310
|
trackEvent("Download", "click", fileName, void 0, { file_type: fileType });
|
|
311
311
|
}
|
|
312
|
-
/**
|
|
312
|
+
/** Get current session data */
|
|
313
313
|
getSessionData() {
|
|
314
314
|
return {
|
|
315
315
|
duration: Math.round((Date.now() - this.sessionStartTime) / 1e3),
|
|
@@ -318,7 +318,7 @@ var LandingTracker = class {
|
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
// ====================================
|
|
321
|
-
//
|
|
321
|
+
// PRIVATE METHODS
|
|
322
322
|
// ====================================
|
|
323
323
|
captureInitialData() {
|
|
324
324
|
const utmParams = captureUTMParams();
|
|
@@ -516,7 +516,7 @@ var VideoTracker = class {
|
|
|
516
516
|
this.watchTimeIntervals = /* @__PURE__ */ new Map();
|
|
517
517
|
}
|
|
518
518
|
/**
|
|
519
|
-
*
|
|
519
|
+
* Initializes tracking for a video.
|
|
520
520
|
*/
|
|
521
521
|
initVideo(videoId) {
|
|
522
522
|
if (this.videos.has(videoId)) return;
|
|
@@ -544,7 +544,7 @@ var VideoTracker = class {
|
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
547
|
-
*
|
|
547
|
+
* Tracks a play event.
|
|
548
548
|
*/
|
|
549
549
|
trackPlay(videoId, currentTime = 0) {
|
|
550
550
|
const state = this.getOrCreateState(videoId);
|
|
@@ -560,7 +560,7 @@ var VideoTracker = class {
|
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
562
|
/**
|
|
563
|
-
*
|
|
563
|
+
* Tracks a pause event.
|
|
564
564
|
*/
|
|
565
565
|
trackPause(videoId, currentTime, duration) {
|
|
566
566
|
const state = this.getOrCreateState(videoId);
|
|
@@ -582,7 +582,7 @@ var VideoTracker = class {
|
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
585
|
+
* Tracks a seek event (timeline jump).
|
|
586
586
|
*/
|
|
587
587
|
trackSeek(videoId, fromTime, toTime) {
|
|
588
588
|
const state = this.getOrCreateState(videoId);
|
|
@@ -597,7 +597,7 @@ var VideoTracker = class {
|
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
/**
|
|
600
|
-
*
|
|
600
|
+
* Tracks progress milestones (25%, 50%, 75%).
|
|
601
601
|
*/
|
|
602
602
|
trackProgress(videoId, percentage, currentTime) {
|
|
603
603
|
const state = this.getOrCreateState(videoId);
|
|
@@ -613,7 +613,7 @@ var VideoTracker = class {
|
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
616
|
-
*
|
|
616
|
+
* Tracks video completion (>=95%).
|
|
617
617
|
*/
|
|
618
618
|
trackComplete(videoId, totalDuration) {
|
|
619
619
|
const state = this.getOrCreateState(videoId);
|
|
@@ -630,7 +630,7 @@ var VideoTracker = class {
|
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
633
|
-
*
|
|
633
|
+
* Tracks video end (native ended event).
|
|
634
634
|
*/
|
|
635
635
|
trackEnd(videoId) {
|
|
636
636
|
const state = this.getOrCreateState(videoId);
|
|
@@ -643,7 +643,7 @@ var VideoTracker = class {
|
|
|
643
643
|
});
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
|
-
*
|
|
646
|
+
* Tracks playback speed change.
|
|
647
647
|
*/
|
|
648
648
|
trackSpeedChange(videoId, speed) {
|
|
649
649
|
const state = this.getOrCreateState(videoId);
|
|
@@ -654,7 +654,7 @@ var VideoTracker = class {
|
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
/**
|
|
657
|
-
*
|
|
657
|
+
* Tracks fullscreen toggle.
|
|
658
658
|
*/
|
|
659
659
|
trackFullscreen(videoId, isFullscreen) {
|
|
660
660
|
trackEvent("Video", isFullscreen ? "fullscreen_enter" : "fullscreen_exit", videoId, void 0, {
|
|
@@ -663,7 +663,7 @@ var VideoTracker = class {
|
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
665
|
/**
|
|
666
|
-
*
|
|
666
|
+
* Tracks no interaction (user is on the page but not interacting with the video).
|
|
667
667
|
*/
|
|
668
668
|
trackNoInteraction(videoId, timeOnPage) {
|
|
669
669
|
trackEvent("Video", "no_interaction", videoId, void 0, {
|
|
@@ -672,20 +672,20 @@ var VideoTracker = class {
|
|
|
672
672
|
});
|
|
673
673
|
}
|
|
674
674
|
/**
|
|
675
|
-
*
|
|
675
|
+
* Returns the current state of a video.
|
|
676
676
|
*/
|
|
677
677
|
getState(videoId) {
|
|
678
678
|
return this.videos.get(videoId);
|
|
679
679
|
}
|
|
680
680
|
/**
|
|
681
|
-
*
|
|
681
|
+
* Cleans up tracking for a specific video.
|
|
682
682
|
*/
|
|
683
683
|
cleanup(videoId) {
|
|
684
684
|
this.stopWatchTimeTracking(videoId);
|
|
685
685
|
this.videos.delete(videoId);
|
|
686
686
|
}
|
|
687
687
|
/**
|
|
688
|
-
*
|
|
688
|
+
* Cleans up all video tracking.
|
|
689
689
|
*/
|
|
690
690
|
cleanupAll() {
|
|
691
691
|
for (const videoId of this.videos.keys()) {
|
|
@@ -693,7 +693,7 @@ var VideoTracker = class {
|
|
|
693
693
|
}
|
|
694
694
|
this.videos.clear();
|
|
695
695
|
}
|
|
696
|
-
// ---
|
|
696
|
+
// --- Private methods ---
|
|
697
697
|
getOrCreateState(videoId) {
|
|
698
698
|
if (!this.videos.has(videoId)) {
|
|
699
699
|
this.initVideo(videoId);
|