@dotcms/analytics 0.0.1-beta.9 → 1.0.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.
Files changed (36) hide show
  1. package/README.md +167 -100
  2. package/lib/dotAnalytics/dot-content-analytics.d.ts +5 -5
  3. package/lib/dotAnalytics/dot-content-analytics.js +28 -9
  4. package/lib/dotAnalytics/plugin/dot-analytics.plugin.d.ts +9 -7
  5. package/lib/dotAnalytics/plugin/dot-analytics.plugin.js +55 -31
  6. package/lib/dotAnalytics/plugin/enricher/dot-analytics.enricher.plugin.d.ts +45 -0
  7. package/lib/dotAnalytics/plugin/enricher/dot-analytics.enricher.plugin.js +34 -0
  8. package/lib/dotAnalytics/plugin/identity/dot-analytics.identity.plugin.d.ts +80 -0
  9. package/lib/dotAnalytics/plugin/identity/dot-analytics.identity.plugin.js +40 -0
  10. package/lib/dotAnalytics/plugin/identity/dot-analytics.identity.utils.d.ts +24 -0
  11. package/lib/dotAnalytics/shared/dot-content-analytics.activity-tracker.d.ts +29 -0
  12. package/lib/dotAnalytics/shared/dot-content-analytics.activity-tracker.js +86 -0
  13. package/lib/dotAnalytics/shared/dot-content-analytics.constants.d.ts +28 -8
  14. package/lib/dotAnalytics/shared/dot-content-analytics.constants.js +12 -8
  15. package/lib/dotAnalytics/shared/dot-content-analytics.http.d.ts +5 -5
  16. package/lib/dotAnalytics/shared/dot-content-analytics.http.js +19 -12
  17. package/lib/dotAnalytics/shared/dot-content-analytics.model.d.ts +303 -88
  18. package/lib/dotAnalytics/shared/dot-content-analytics.utils.d.ts +86 -29
  19. package/lib/dotAnalytics/shared/dot-content-analytics.utils.js +118 -41
  20. package/lib/react/components/DotContentAnalyticsProvider.d.ts +4 -4
  21. package/lib/react/components/DotContentAnalyticsProvider.js +5 -2
  22. package/lib/react/contexts/DotContentAnalyticsContext.d.ts +3 -3
  23. package/lib/react/hook/useContentAnalytics.d.ts +36 -6
  24. package/lib/react/hook/useContentAnalytics.js +22 -24
  25. package/lib/react/hook/useRouterTracker.d.ts +3 -3
  26. package/lib/react/hook/useRouterTracker.js +8 -7
  27. package/lib/standalone.d.ts +2 -2
  28. package/package.json +5 -4
  29. package/types/src/lib/editor/public.js +5 -0
  30. package/types/src/lib/events/internal.js +4 -0
  31. package/uve/src/internal/constants.js +3 -0
  32. package/uve/src/internal/events.js +108 -0
  33. package/uve/src/lib/core/core.utils.js +21 -0
  34. package/uve/src/lib/dom/dom.utils.js +81 -0
  35. package/lib/dotAnalytics/plugin/dot-analytics.enricher.plugin.d.ts +0 -31
  36. package/lib/dotAnalytics/plugin/dot-analytics.enricher.plugin.js +0 -28
@@ -1,11 +1,15 @@
1
- import { ANALYTICS_PAGEVIEW_EVENT, EventType, EXPECTED_UTM_KEYS } from './dot-content-analytics.constants';
1
+ import { EVENT_TYPES } from './dot-content-analytics.constants';
2
2
 
3
+ declare global {
4
+ interface Window {
5
+ __dotAnalyticsCleanup?: () => void;
6
+ }
7
+ }
3
8
  /**
4
- * Configuration interface for DotAnalytics SDK.
5
- *
6
- * @interface DotAnalyticsConfig
9
+ * Configuration interface for DotCMS Analytics SDK.
10
+ * Contains all necessary settings for initializing and configuring the analytics client.
7
11
  */
8
- export interface DotContentAnalyticsConfig {
12
+ export interface DotCMSAnalyticsConfig {
9
13
  /**
10
14
  * The URL of the Analytics server endpoint.
11
15
  */
@@ -19,125 +23,336 @@ export interface DotContentAnalyticsConfig {
19
23
  */
20
24
  autoPageView?: boolean;
21
25
  /**
22
- * The API key for authenticating with the Analytics service.
26
+ * The site key for authenticating with the Analytics service.
23
27
  */
24
- apiKey: string;
28
+ siteKey: string;
25
29
  /**
26
30
  * Custom redirect function handler.
27
31
  * When provided, this function will be called instead of the default browser redirect
28
32
  * for handling URL redirections.
29
- *
30
- * @param {string} url - The URL to redirect to
31
33
  */
32
34
  redirectFn?: (url: string) => void;
33
35
  }
34
- type UTMParams = {
35
- [key in (typeof EXPECTED_UTM_KEYS)[number] as key extends `utm_${infer U}` ? U : never]?: string;
36
- };
37
- interface BaseEventData {
38
- anonymousId?: string;
39
- src: string;
40
- utc_time: string;
41
- local_tz_offset: number;
42
- doc_path: string;
43
- doc_host: string;
36
+ /**
37
+ * Supported event types in DotCMS Analytics.
38
+ * Only two event types are supported: pageview and track.
39
+ */
40
+ export type DotCMSEventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
41
+ /**
42
+ * Base structure for all analytics events.
43
+ * All events share this common structure.
44
+ */
45
+ export interface DotCMSEventBase {
46
+ /** The type of event being tracked */
47
+ event_type: DotCMSEventType;
48
+ /** Local timestamp when the event occurred */
49
+ local_time: string;
50
+ }
51
+ /**
52
+ * Pageview-specific analytics event structure.
53
+ * Contains data specific to page view tracking.
54
+ */
55
+ export interface DotCMSPageViewEvent extends DotCMSEventBase {
56
+ event_type: 'pageview';
57
+ /** Pageview-specific event data with structured format */
58
+ data: {
59
+ /** Page data associated with the event */
60
+ page: DotCMSPageData;
61
+ /** Device and browser information */
62
+ device: DotCMSDeviceData;
63
+ /** UTM parameters for campaign tracking (optional) */
64
+ utm?: DotCMSUtmData;
65
+ };
66
+ }
67
+ /**
68
+ * Track-specific analytics event structure.
69
+ * Contains data specific to custom event tracking.
70
+ */
71
+ export interface DotCMSTrackEvent extends DotCMSEventBase {
72
+ event_type: 'track';
73
+ /** Track-specific event data with flexible structure */
74
+ data: Record<string, unknown>;
75
+ }
76
+ /**
77
+ * Union type for all possible analytics events.
78
+ */
79
+ export type DotCMSEvent = DotCMSPageViewEvent | DotCMSTrackEvent;
80
+ /**
81
+ * Analytics request body for page view events in DotCMS.
82
+ * Structure sent to the DotCMS analytics server for page tracking.
83
+ */
84
+ export interface DotCMSPageViewRequestBody {
85
+ /** Context information shared across all events */
86
+ context: DotCMSAnalyticsContext;
87
+ /** Array of pageview analytics events to be tracked */
88
+ events: DotCMSPageViewEvent[];
89
+ }
90
+ /**
91
+ * Analytics request body for track events in DotCMS.
92
+ * Structure sent to the DotCMS analytics server for custom event tracking.
93
+ */
94
+ export interface DotCMSTrackRequestBody {
95
+ /** Context information shared across all events */
96
+ context: DotCMSAnalyticsContext;
97
+ /** Array of track analytics events to be tracked */
98
+ events: DotCMSTrackEvent[];
44
99
  }
45
- export interface BrowserEventData {
100
+ /**
101
+ * Union type for all possible request bodies.
102
+ */
103
+ export type DotCMSAnalyticsRequestBody = DotCMSPageViewRequestBody | DotCMSTrackRequestBody;
104
+ /**
105
+ * Enriched payload structure returned by the enricher plugin.
106
+ * Contains pre-structured events and context for direct use in analytics requests.
107
+ */
108
+ export interface DotCMSEnrichedPayload {
109
+ /** Analytics context shared across events */
110
+ context: DotCMSAnalyticsContext;
111
+ /** Array of pre-structured analytics events */
112
+ events: DotCMSEvent[];
113
+ }
114
+ /**
115
+ * Browser event data collected from the user's session in DotCMS.
116
+ * Contains comprehensive information about the user's browser environment,
117
+ * page context, and session details for analytics tracking.
118
+ */
119
+ export interface DotCMSBrowserEventData {
120
+ /** UTC timestamp when the event occurred */
46
121
  utc_time: string;
122
+ /** Local timezone offset in minutes */
47
123
  local_tz_offset: number;
48
- screen_resolution: string;
49
- vp_size: string;
50
- userAgent: string;
51
- user_language: string;
52
- doc_encoding: string;
53
- doc_path: string;
54
- doc_host: string;
55
- doc_protocol: string;
124
+ /** Screen resolution as a string (e.g., "1920x1080") */
125
+ screen_resolution: string | undefined;
126
+ /** Viewport size as a string (e.g., "1200x800") */
127
+ vp_size: string | undefined;
128
+ /** User's preferred language */
129
+ user_language: string | undefined;
130
+ /** Document encoding */
131
+ doc_encoding: string | undefined;
132
+ /** Document path */
133
+ doc_path: string | undefined;
134
+ /** Document host */
135
+ doc_host: string | undefined;
136
+ /** Document protocol (http/https) */
137
+ doc_protocol: string | undefined;
138
+ /** Document hash fragment */
56
139
  doc_hash: string;
140
+ /** Document search parameters */
57
141
  doc_search: string;
58
- referrer: string;
59
- page_title: string;
60
- utm: UTMParams;
142
+ /** Referrer URL */
143
+ referrer: string | undefined;
144
+ /** Page title */
145
+ page_title: string | undefined;
146
+ /** Current page URL */
147
+ url: string | undefined;
148
+ /** UTM parameters for campaign tracking */
149
+ utm: Record<string, string>;
61
150
  }
62
- export interface PageViewEvent extends BaseEventData, BrowserEventData {
63
- event_type: typeof ANALYTICS_PAGEVIEW_EVENT;
151
+ /**
152
+ * The payload structure for DotCMS analytics events.
153
+ * This interface represents the complete data structure that flows through
154
+ * the analytics pipeline, including original event data and enriched context.
155
+ *
156
+ * This is the internal payload used by Analytics.js and our plugins.
157
+ */
158
+ export interface DotCMSAnalyticsPayload {
159
+ /** The event name or identifier */
160
+ event: string;
161
+ /** Additional properties associated with the event */
162
+ properties: Record<string, unknown>;
163
+ /** Configuration options for the event */
164
+ options: Record<string, unknown>;
165
+ /** Analytics context shared across events */
166
+ context?: DotCMSAnalyticsContext;
167
+ /** Page data for the current page */
168
+ page?: DotCMSPageData;
169
+ /** Device and browser information */
170
+ device?: DotCMSDeviceData;
171
+ /** UTM parameters for campaign tracking */
172
+ utm?: DotCMSUtmData;
173
+ /** Local timestamp when the event occurred */
174
+ local_time: string;
64
175
  }
65
- export interface TrackEvent {
66
- event_type: 'track';
67
- custom_event: string;
68
- [key: string]: unknown;
176
+ /**
177
+ * Parameters passed to DotCMS Analytics plugin methods.
178
+ * Contains the configuration and payload data needed for processing analytics events.
179
+ */
180
+ export interface DotCMSAnalyticsParams {
181
+ /** Configuration for the analytics client */
182
+ config: DotCMSAnalyticsConfig;
183
+ /** The event payload to be processed */
184
+ payload: DotCMSAnalyticsPayload;
69
185
  }
70
- export interface TrackPayload extends DotAnalyticsPayload {
71
- type: EventType.Track;
72
- properties: Record<string, unknown> & {
73
- title: string;
74
- url: string;
75
- path: string;
76
- hash: string;
77
- search: string;
78
- width: number;
79
- height: number;
80
- source: string;
81
- };
186
+ /**
187
+ * Main interface for the DotCMS Analytics SDK.
188
+ * Provides the core methods for tracking page views and custom events.
189
+ */
190
+ export interface DotCMSAnalytics {
191
+ /**
192
+ * Track a page view event.
193
+ */
194
+ pageView: () => void;
195
+ /**
196
+ * Track a custom event.
197
+ * @param eventName - The name/type of the event to track
198
+ * @param payload - Optional additional data to include with the event
199
+ */
200
+ track: (eventName: string, payload?: Record<string, unknown>) => void;
82
201
  }
83
- export interface PageViewPayload extends DotAnalyticsPayload {
84
- type: EventType.PageView;
85
- properties: {
86
- title: string;
87
- url: string;
88
- path: string;
89
- hash: string;
90
- search: string;
91
- width: number;
92
- height: number;
93
- source: string;
94
- };
202
+ /**
203
+ * Analytics context shared across all events in DotCMS.
204
+ * Contains session and user identification data that provides
205
+ * continuity across multiple analytics events.
206
+ */
207
+ export interface DotCMSAnalyticsContext {
208
+ /** The site key for the DotCMS instance */
209
+ site_key: string;
210
+ /** Unique session identifier */
211
+ session_id: string;
212
+ /** Unique user identifier */
213
+ user_id: string;
95
214
  }
96
215
  /**
97
- * The payload for a track event.
216
+ * Device and browser information for DotCMS analytics tracking.
217
+ * Contains technical details about the user's device and browser environment.
98
218
  */
99
- export interface DotAnalyticsPayload {
219
+ export interface DotCMSDeviceData {
220
+ /** Screen resolution as a string (e.g., "1920x1080") */
221
+ screen_resolution: string | undefined;
222
+ /** User's preferred language */
223
+ language: string | undefined;
224
+ /** Viewport width in pixels */
225
+ viewport_width: string | undefined;
226
+ /** Viewport height in pixels */
227
+ viewport_height: string | undefined;
228
+ }
229
+ /**
230
+ * UTM (Urchin Tracking Module) parameters for DotCMS campaign tracking.
231
+ * Contains marketing campaign attribution data extracted from URL parameters.
232
+ */
233
+ export interface DotCMSUtmData {
234
+ /** The marketing medium (e.g., email, social, cpc) */
235
+ medium?: string;
236
+ /** The traffic source (e.g., google, newsletter) */
237
+ source?: string;
238
+ /** The campaign name */
239
+ campaign?: string;
240
+ /** The campaign term or keyword */
241
+ term?: string;
242
+ /** The campaign content or ad variation */
243
+ content?: string;
244
+ /** The campaign ID for tracking specific campaigns */
245
+ id?: string;
246
+ }
247
+ /**
248
+ * Page data structure for DotCMS analytics.
249
+ * Contains comprehensive information about the current page and its context
250
+ * within the DotCMS environment.
251
+ */
252
+ export interface DotCMSPageData {
253
+ /** The current page URL */
254
+ url: string | undefined;
255
+ /** Document encoding */
256
+ doc_encoding: string | undefined;
257
+ /** Document hash fragment */
258
+ doc_hash: string;
259
+ /** Document protocol (http/https) */
260
+ doc_protocol: string | undefined;
261
+ /** Document search parameters */
262
+ doc_search: string;
263
+ /** Document host domain */
264
+ doc_host: string | undefined;
265
+ /** Document path */
266
+ doc_path: string | undefined;
267
+ /** Page title */
268
+ title: string | undefined;
269
+ /** Language identifier */
270
+ language_id?: string;
271
+ /** Persona identifier */
272
+ persona?: string;
273
+ }
274
+ /**
275
+ * Analytics.js hook parameter types for DotCMS.
276
+ * Represents the payload structure used by Analytics.js lifecycle hooks
277
+ * for intercepting and modifying analytics events.
278
+ */
279
+ export interface DotCMSAnalyticsHookPayload {
280
+ /** The type of analytics event */
100
281
  type: string;
282
+ /** Properties associated with the event */
101
283
  properties: {
284
+ /** Page title */
102
285
  title: string;
286
+ /** Page URL */
103
287
  url: string;
288
+ /** Page path */
104
289
  path: string;
290
+ /** URL hash fragment */
105
291
  hash: string;
292
+ /** URL search parameters */
106
293
  search: string;
294
+ /** Viewport width */
107
295
  width: number;
296
+ /** Viewport height */
108
297
  height: number;
109
- source: string;
298
+ /** Referrer URL */
299
+ referrer?: string;
110
300
  };
111
- event: string;
301
+ /** Configuration options for the event */
112
302
  options: Record<string, unknown>;
303
+ /** User identifier */
113
304
  userId: string | null;
114
- anonymousId: string | null;
115
- }
116
- /**
117
- * Add ServerEvent type for HTTP layer
118
- */
119
- export interface ServerEvent extends Record<string, unknown> {
120
- timestamp: string;
121
- key: string;
122
- }
123
- /**
124
- * Interface for the AnalyticsTracker.
125
- */
126
- export interface DotContentAnalyticsCustomHook {
127
- track: (eventName: string, payload?: Record<string, unknown>) => void;
305
+ /** Anonymous user identifier */
306
+ anonymousId: string;
307
+ /** Metadata about the event */
308
+ meta: {
309
+ /** Request identifier */
310
+ rid: string;
311
+ /** Timestamp */
312
+ ts: number;
313
+ /** Whether the event has a callback function */
314
+ hasCallback: boolean;
315
+ };
128
316
  }
129
317
  /**
130
- * Params for the DotAnalytics plugin
318
+ * Analytics.js instance structure for DotCMS.
319
+ * Represents the internal structure of an Analytics.js instance,
320
+ * providing access to plugins, storage, and event configuration.
131
321
  */
132
- export interface DotAnalyticsParams {
133
- config: DotContentAnalyticsConfig;
134
- payload: DotAnalyticsPayload;
322
+ export interface DotCMSAnalyticsInstance {
323
+ /** Available plugins and their configurations */
324
+ plugins: Record<string, unknown>;
325
+ /** Storage mechanisms for analytics data */
326
+ storage: Record<string, unknown>;
327
+ /** Event configuration */
328
+ events: {
329
+ /** Core event types */
330
+ core: string[];
331
+ /** Plugin-specific event types */
332
+ plugins: string[];
333
+ };
135
334
  }
136
335
  /**
137
- * Shared interface for the DotAnalytics plugin
336
+ * Parameters passed to Analytics.js hook functions in DotCMS.
337
+ * Contains all the context and data needed for Analytics.js lifecycle hooks
338
+ * to process and modify analytics events.
138
339
  */
139
- export interface DotAnalytics {
140
- pageView: (payload?: Record<string, unknown>) => void;
141
- track: (eventName: string, payload?: Record<string, unknown>) => void;
340
+ export interface DotCMSAnalyticsHookParams {
341
+ /** The event payload data */
342
+ payload: DotCMSAnalyticsHookPayload;
343
+ /** The analytics instance */
344
+ instance: DotCMSAnalyticsInstance;
345
+ /** Global configuration settings */
346
+ config: Record<string, unknown>;
347
+ /** Available plugins and their status */
348
+ plugins: Record<string, {
349
+ /** Whether the plugin is enabled */
350
+ enabled: boolean;
351
+ /** Whether the plugin is initialized */
352
+ initialized: boolean;
353
+ /** Whether the plugin is loaded */
354
+ loaded: boolean;
355
+ /** Plugin-specific configuration */
356
+ config: Record<string, unknown>;
357
+ }>;
142
358
  }
143
- export {};
@@ -1,48 +1,105 @@
1
- import { BrowserEventData, DotContentAnalyticsConfig } from './dot-content-analytics.model';
1
+ import { DotCMSAnalyticsConfig, DotCMSAnalyticsContext, DotCMSAnalyticsPayload, DotCMSBrowserEventData, DotCMSDeviceData, DotCMSPageData, DotCMSUtmData } from './dot-content-analytics.model';
2
+ import { PageData } from 'analytics';
2
3
 
4
+ export { cleanupActivityTracking, getLastActivity, getSessionInfo, initializeActivityTracking, isUserInactive, updateSessionActivity } from './dot-content-analytics.activity-tracker';
3
5
  /**
4
- * Retrieves analytics attributes from a given script element.
5
- *
6
- * @return {DotAnalyticsConfig | null} - The analytics attributes or null if there are no valid attributes present.
6
+ * Generates a cryptographically secure random ID
7
+ */
8
+ export declare const generateSecureId: (prefix: string) => string;
9
+ /**
10
+ * Safe sessionStorage wrapper with error handling
7
11
  */
8
- export declare const getDataAnalyticsAttributes: (location: Location) => DotContentAnalyticsConfig;
12
+ export declare const safeSessionStorage: {
13
+ getItem: (key: string) => string | null;
14
+ setItem: (key: string, value: string) => void;
15
+ };
9
16
  /**
10
- * Retrieves the analytics script tag from the document.
17
+ * Gets or generates a user ID
18
+ */
19
+ export declare const getUserId: () => string;
20
+ /**
21
+ * Gets session ID with comprehensive lifecycle management
22
+ * Returns existing valid session ID or creates a new one if needed
11
23
  *
12
- * @returns {HTMLScriptElement} - The analytics script tag.
24
+ * Session validation criteria:
25
+ * 1. User is still active (< 30 min inactivity)
26
+ * 2. Session hasn't passed midnight (UTC)
27
+ * 3. UTM parameters haven't changed
28
+ */
29
+ export declare const getSessionId: () => string;
30
+ /**
31
+ * Gets analytics context with user and session identification
32
+ */
33
+ export declare const getAnalyticsContext: (config: DotCMSAnalyticsConfig) => DotCMSAnalyticsContext;
34
+ /**
35
+ * Retrieves analytics attributes from a given script element.
36
+ */
37
+ export declare const getDataAnalyticsAttributes: () => DotCMSAnalyticsConfig;
38
+ /**
39
+ * Gets the analytics script tag from the DOM
13
40
  */
14
41
  export declare const getAnalyticsScriptTag: () => HTMLScriptElement;
15
42
  /**
16
- * Retrieves the browser event data.
17
- *
18
- * @param {Location} location - The location object.
19
- * @returns {BrowserEventData} - The browser event data.
43
+ * Retrieves the browser event data - optimized but accurate.
20
44
  */
21
- export declare const getBrowserEventData: (location: Location) => BrowserEventData;
45
+ export declare const getBrowserEventData: (location: Location) => DotCMSBrowserEventData;
22
46
  /**
23
- * Extracts UTM parameters from a given URL location.
24
- *
25
- * @param {Location} location - The location object containing the URL.
26
- * @returns {Record<string, string>} - An object containing the extracted UTM parameters.
47
+ * Extracts UTM parameters from the URL - cached for performance
27
48
  */
28
49
  export declare const extractUTMParameters: (location: Location) => Record<string, string>;
29
50
  /**
30
- * A function to redirect the user to a new URL.
31
- *
32
- * @param {string} href - The URL to redirect to.
33
- * @returns {void}
51
+ * Default redirect function
34
52
  */
35
53
  export declare const defaultRedirectFn: (href: string) => string;
36
54
  /**
37
- * Checks if the current environment is inside the dotCMS editor.
38
- *
39
- * @returns {boolean} - True if inside the editor, false otherwise.
55
+ * Gets local time in ISO format without milliseconds
40
56
  */
41
- export declare const isInsideEditor: () => boolean;
57
+ export declare const getLocalTime: () => string;
42
58
  /**
43
- * Creates an analytics instance.
44
- *
45
- * @param {DotContentAnalyticsConfig} config - The configuration object for the analytics instance.
46
- * @returns {Analytics | null} - The analytics instance or null if there is an error.
59
+ * Gets page data from browser event data and payload
60
+ */
61
+ export declare const getPageData: (browserData: DotCMSBrowserEventData, payload: DotCMSAnalyticsPayload) => PageData;
62
+ /**
63
+ * Gets device data from browser event data
64
+ */
65
+ export declare const getDeviceData: (browserData: DotCMSBrowserEventData) => DotCMSDeviceData;
66
+ /**
67
+ * Gets UTM data from browser event data
68
+ */
69
+ export declare const getUtmData: (browserData: DotCMSBrowserEventData) => DotCMSUtmData;
70
+ /**
71
+ * Enriches payload with UTM data
72
+ */
73
+ export declare const enrichWithUtmData: (payload: DotCMSAnalyticsPayload) => DotCMSAnalyticsPayload;
74
+ /**
75
+ * Optimized payload enrichment using existing analytics.js data
76
+ * Reuses payload.properties data instead of recalculating from DOM when available
77
+ * Maintains the same output structure as the original function
78
+ */
79
+ export declare const enrichPagePayloadOptimized: (payload: DotCMSAnalyticsPayload, location?: Location) => {
80
+ local_time: string;
81
+ utm?: DotCMSUtmData | undefined;
82
+ page: DotCMSPageData;
83
+ device: DotCMSDeviceData;
84
+ event: string;
85
+ properties: Record<string, unknown>;
86
+ options: Record<string, unknown>;
87
+ context?: DotCMSAnalyticsContext | undefined;
88
+ };
89
+ /**
90
+ * @deprecated Use enrichPagePayloadOptimized instead to avoid data duplication
91
+ * Legacy function that enriches page payload with all data in one call
92
+ * This function duplicates data already available in analytics.js payload
47
93
  */
48
- export declare const createAnalyticsInstance: (config: DotContentAnalyticsConfig) => import('analytics').AnalyticsInstance | null;
94
+ export declare const enrichPagePayload: (payload: DotCMSAnalyticsPayload, location?: Location) => {
95
+ payload: {
96
+ local_time: string;
97
+ utm?: DotCMSUtmData | undefined;
98
+ page: PageData;
99
+ device: DotCMSDeviceData;
100
+ event: string;
101
+ properties: Record<string, unknown>;
102
+ options: Record<string, unknown>;
103
+ context?: DotCMSAnalyticsContext | undefined;
104
+ };
105
+ };