@dotcms/analytics 26.9.17-2-next.2713 → 26.9.18-1-next.2741
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/MIGRATION.md +42 -0
- package/README.md +10 -1
- package/index.d.ts +1 -1
- package/index.js +4 -4
- package/lib/core/dot-analytics.content.js +10 -11
- package/lib/core/plugin/identity/dot-analytics.identity.plugin.d.ts +4 -4
- package/lib/core/plugin/impression/dot-analytics.impression-tracker.js +13 -13
- package/lib/core/public-api.d.ts +12 -0
- package/lib/core/shared/constants/dot-analytics.constants.js +24 -23
- package/lib/core/shared/http/dot-analytics.http.js +3 -3
- package/lib/core/shared/queue/dot-analytics.queue.utils.js +13 -13
- package/lib/core/shared/utils/dot-analytics.utils.js +223 -153
- package/lib/react/hook/useContentAnalytics.js +6 -7
- package/package.json +19 -7
- package/types/src/lib/editor/public.js +2 -3
- package/uve/src/lib/core/core.utils.js +2 -3
- package/types/src/lib/events/internal.js +0 -4
- package/uve/src/internal/constants.js +0 -7
- package/uve/src/internal/contentlet-sentinel.constants.js +0 -5
- package/uve/src/internal/events.js +0 -196
- package/uve/src/lib/dom/dom.utils.js +0 -103
|
@@ -1,237 +1,307 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
return
|
|
1
|
+
import { DotLogger as v } from "../dot-analytics.logger.js";
|
|
2
|
+
import { ANALYTICS_MINIFIED_SCRIPT_NAME as b, ANALYTICS_JS_DEFAULT_PROPERTIES as A, SESSION_STORAGE_KEY as h, DEFAULT_SESSION_TIMEOUT_MINUTES as I, USER_ID_KEY as p, EXPECTED_UTM_KEYS as _, CONTENTLET_CLASS as m, DEFAULT_IMPRESSION_MUTATION_OBSERVER_DEBOUNCE_MS as T } from "../constants/dot-analytics.constants.js";
|
|
3
|
+
function R(e) {
|
|
4
|
+
const s = [];
|
|
5
|
+
return e.siteAuth?.trim() || s.push('"siteAuth"'), e.server?.trim() || s.push('"server"'), s.length > 0 ? s : null;
|
|
6
6
|
}
|
|
7
|
-
let
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
return `${
|
|
11
|
-
},
|
|
12
|
-
getItem: (
|
|
7
|
+
let d = null, g = null;
|
|
8
|
+
const f = (e) => {
|
|
9
|
+
const s = Date.now(), t = Math.random().toString(36).substr(2, 9), o = Math.random().toString(36).substr(2, 9);
|
|
10
|
+
return `${e}_${s}_${t}${o}`;
|
|
11
|
+
}, S = {
|
|
12
|
+
getItem: (e) => {
|
|
13
13
|
try {
|
|
14
|
-
return localStorage.getItem(
|
|
14
|
+
return localStorage.getItem(e);
|
|
15
15
|
} catch {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
setItem: (
|
|
19
|
+
setItem: (e, s) => {
|
|
20
20
|
try {
|
|
21
|
-
localStorage.setItem(
|
|
22
|
-
} catch (
|
|
23
|
-
throw console.warn(`DotCMS Analytics [Core]: Could not save ${
|
|
21
|
+
localStorage.setItem(e, s);
|
|
22
|
+
} catch (t) {
|
|
23
|
+
throw console.warn(`DotCMS Analytics [Core]: Could not save ${e} to localStorage`), t;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
getItem: (
|
|
26
|
+
}, x = {
|
|
27
|
+
getItem: (e) => {
|
|
28
28
|
try {
|
|
29
|
-
return sessionStorage.getItem(
|
|
29
|
+
return sessionStorage.getItem(e);
|
|
30
30
|
} catch {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
|
-
setItem: (
|
|
34
|
+
setItem: (e, s) => {
|
|
35
35
|
try {
|
|
36
|
-
sessionStorage.setItem(
|
|
37
|
-
} catch (
|
|
38
|
-
throw console.warn(`DotCMS Analytics [Core]: Could not save ${
|
|
36
|
+
sessionStorage.setItem(e, s);
|
|
37
|
+
} catch (t) {
|
|
38
|
+
throw console.warn(`DotCMS Analytics [Core]: Could not save ${e} to sessionStorage`), t;
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
removeItem: (
|
|
41
|
+
removeItem: (e) => {
|
|
42
42
|
try {
|
|
43
|
-
sessionStorage.removeItem(
|
|
43
|
+
sessionStorage.removeItem(e);
|
|
44
44
|
} catch {
|
|
45
|
-
console.warn(`DotCMS Analytics [Core]: Could not remove ${
|
|
45
|
+
console.warn(`DotCMS Analytics [Core]: Could not remove ${e} from sessionStorage`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
},
|
|
49
|
-
let
|
|
50
|
-
if (!
|
|
51
|
-
|
|
48
|
+
}, C = () => {
|
|
49
|
+
let e = S.getItem(p);
|
|
50
|
+
if (!e) {
|
|
51
|
+
e = f("user");
|
|
52
52
|
try {
|
|
53
|
-
|
|
53
|
+
S.setItem(p, e);
|
|
54
54
|
} catch {
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
return
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
return
|
|
65
|
-
},
|
|
66
|
-
const
|
|
57
|
+
return e;
|
|
58
|
+
}, D = (e) => {
|
|
59
|
+
const s = new Date(e), t = /* @__PURE__ */ new Date(), o = new Date(
|
|
60
|
+
s.getUTCFullYear(),
|
|
61
|
+
s.getUTCMonth(),
|
|
62
|
+
s.getUTCDate()
|
|
63
|
+
), n = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
|
|
64
|
+
return o.getTime() !== n.getTime();
|
|
65
|
+
}, E = () => {
|
|
66
|
+
const e = Date.now();
|
|
67
67
|
if (typeof window > "u")
|
|
68
|
-
return
|
|
68
|
+
return f("session_fallback");
|
|
69
69
|
try {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
const { sessionId:
|
|
73
|
-
if (
|
|
70
|
+
const s = sessionStorage.getItem(h);
|
|
71
|
+
if (s) {
|
|
72
|
+
const { sessionId: n, startTime: r, lastActivity: c } = JSON.parse(s), i = !D(r), u = e - c < I * 60 * 1e3;
|
|
73
|
+
if (i && u)
|
|
74
74
|
return sessionStorage.setItem(
|
|
75
75
|
h,
|
|
76
76
|
JSON.stringify({
|
|
77
|
-
sessionId:
|
|
77
|
+
sessionId: n,
|
|
78
78
|
startTime: r,
|
|
79
|
-
lastActivity:
|
|
79
|
+
lastActivity: e
|
|
80
80
|
})
|
|
81
|
-
),
|
|
81
|
+
), n;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
sessionId:
|
|
85
|
-
startTime:
|
|
86
|
-
lastActivity:
|
|
83
|
+
const t = f("session"), o = {
|
|
84
|
+
sessionId: t,
|
|
85
|
+
startTime: e,
|
|
86
|
+
lastActivity: e
|
|
87
87
|
};
|
|
88
|
-
return sessionStorage.setItem(h, JSON.stringify(
|
|
88
|
+
return sessionStorage.setItem(h, JSON.stringify(o)), t;
|
|
89
89
|
} catch {
|
|
90
|
-
return
|
|
90
|
+
return f("session_fallback");
|
|
91
91
|
}
|
|
92
|
-
},
|
|
93
|
-
const
|
|
92
|
+
}, k = (e) => {
|
|
93
|
+
const s = E(), t = C(), o = M();
|
|
94
94
|
return {
|
|
95
|
-
site_auth:
|
|
96
|
-
session_id:
|
|
97
|
-
user_id:
|
|
98
|
-
device:
|
|
95
|
+
site_auth: e.siteAuth,
|
|
96
|
+
session_id: s,
|
|
97
|
+
user_id: t,
|
|
98
|
+
device: o
|
|
99
|
+
};
|
|
100
|
+
}, B = () => {
|
|
101
|
+
const e = document.querySelector(
|
|
102
|
+
`script[src*="${b}"][data-analytics-auth]`
|
|
103
|
+
);
|
|
104
|
+
if (e) {
|
|
105
|
+
const s = e.getAttribute("data-analytics-config");
|
|
106
|
+
let t = {};
|
|
107
|
+
if (s)
|
|
108
|
+
try {
|
|
109
|
+
const a = JSON.parse(s);
|
|
110
|
+
t = y(a);
|
|
111
|
+
} catch {
|
|
112
|
+
try {
|
|
113
|
+
const a = s.replace(/([{,]\s*)'(.+?)'(\s*:)/g, '$1"$2"$3').replace(/(:\s*)'(.+?)'(\s*[,}\]])/g, '$1"$2"$3'), l = JSON.parse(a);
|
|
114
|
+
t = y(l);
|
|
115
|
+
} catch (a) {
|
|
116
|
+
console.error("Failed to parse data-analytics-config JSON:", a);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const o = e.getAttribute("data-analytics-server"), n = e.getAttribute("data-analytics-debug"), r = e.getAttribute("data-analytics-auto-page-view"), c = e.getAttribute("data-analytics-auth"), i = e.getAttribute("data-analytics-impressions"), u = e.getAttribute("data-analytics-clicks");
|
|
120
|
+
return {
|
|
121
|
+
// 1. Default fallback values
|
|
122
|
+
server: window.location.origin,
|
|
123
|
+
debug: !1,
|
|
124
|
+
autoPageView: !0,
|
|
125
|
+
siteAuth: "",
|
|
126
|
+
// 2. Advanced config (JSON)
|
|
127
|
+
...t,
|
|
128
|
+
// 3. Explicit attributes (highest priority)
|
|
129
|
+
...o && { server: o },
|
|
130
|
+
...n && { debug: n === "true" },
|
|
131
|
+
// autoPageView is opt-out: presence of the attribute overrides JSON config; only the
|
|
132
|
+
// literal string "false" disables it (any other value, including "", enables it)
|
|
133
|
+
...r !== null && { autoPageView: r !== "false" },
|
|
134
|
+
...c && { siteAuth: c },
|
|
135
|
+
...i && { impressions: i === "true" },
|
|
136
|
+
...u && { clicks: u === "true" }
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return console.warn("[DotCMS Analytics] Script wrapper not found - verify installation"), {
|
|
140
|
+
server: window.location.origin,
|
|
141
|
+
debug: !1,
|
|
142
|
+
autoPageView: !0,
|
|
143
|
+
siteAuth: ""
|
|
99
144
|
};
|
|
100
|
-
},
|
|
145
|
+
}, w = () => d || (d = {
|
|
101
146
|
user_language: navigator.language,
|
|
102
147
|
doc_encoding: document.characterSet || document.charset,
|
|
103
148
|
screen_resolution: typeof screen < "u" && screen.width && screen.height ? `${screen.width}x${screen.height}` : ""
|
|
104
|
-
},
|
|
105
|
-
const
|
|
149
|
+
}, d), M = () => {
|
|
150
|
+
const e = w(), s = window.innerWidth || document.documentElement.clientWidth || 0, t = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
106
151
|
return {
|
|
107
|
-
screen_resolution:
|
|
108
|
-
language:
|
|
109
|
-
viewport_width: String(
|
|
110
|
-
viewport_height: String(
|
|
152
|
+
screen_resolution: e.screen_resolution ?? "",
|
|
153
|
+
language: e.user_language ?? "",
|
|
154
|
+
viewport_width: String(s),
|
|
155
|
+
viewport_height: String(t)
|
|
111
156
|
};
|
|
112
|
-
},
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
return
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
const r =
|
|
157
|
+
}, N = (e) => {
|
|
158
|
+
const s = e.search;
|
|
159
|
+
if (g && g.search === s)
|
|
160
|
+
return g.params;
|
|
161
|
+
const t = new URLSearchParams(s), o = {};
|
|
162
|
+
return _.forEach((n) => {
|
|
163
|
+
const r = t.get(n);
|
|
119
164
|
if (r) {
|
|
120
|
-
const c =
|
|
121
|
-
|
|
165
|
+
const c = n.replace("utm_", "");
|
|
166
|
+
o[c] = r;
|
|
122
167
|
}
|
|
123
|
-
}),
|
|
168
|
+
}), g = { search: s, params: o }, o;
|
|
124
169
|
}, O = () => {
|
|
125
170
|
try {
|
|
126
|
-
const
|
|
127
|
-
return `${
|
|
171
|
+
const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), s = e > 0 ? "-" : "+", t = Math.abs(e), o = Math.floor(t / 60), n = t % 60;
|
|
172
|
+
return `${s}${o.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
|
|
128
173
|
} catch {
|
|
129
174
|
return "+00:00";
|
|
130
175
|
}
|
|
131
|
-
},
|
|
176
|
+
}, L = () => {
|
|
132
177
|
try {
|
|
133
|
-
const
|
|
134
|
-
return `${
|
|
178
|
+
const e = /* @__PURE__ */ new Date(), s = O(), t = e.getFullYear(), o = (e.getMonth() + 1).toString().padStart(2, "0"), n = e.getDate().toString().padStart(2, "0"), r = e.getHours().toString().padStart(2, "0"), c = e.getMinutes().toString().padStart(2, "0"), i = e.getSeconds().toString().padStart(2, "0");
|
|
179
|
+
return `${t}-${o}-${n}T${r}:${c}:${i}${s}`;
|
|
135
180
|
} catch {
|
|
136
181
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
137
182
|
}
|
|
138
|
-
},
|
|
139
|
-
const
|
|
140
|
-
Object.keys(
|
|
141
|
-
|
|
183
|
+
}, j = (e, s = typeof window < "u" ? window.location : {}) => {
|
|
184
|
+
const t = L(), o = w(), { properties: n } = e, r = {};
|
|
185
|
+
Object.keys(n).forEach((a) => {
|
|
186
|
+
A.includes(a) || (r[a] = n[a]);
|
|
142
187
|
});
|
|
143
|
-
const c =
|
|
144
|
-
url:
|
|
145
|
-
doc_encoding:
|
|
146
|
-
doc_hash:
|
|
147
|
-
doc_protocol:
|
|
148
|
-
doc_search:
|
|
149
|
-
doc_host:
|
|
150
|
-
doc_path:
|
|
151
|
-
title:
|
|
188
|
+
const c = e.context?.device?.language?.toLowerCase() ?? "", i = {
|
|
189
|
+
url: s.href,
|
|
190
|
+
doc_encoding: o.doc_encoding,
|
|
191
|
+
doc_hash: s.hash,
|
|
192
|
+
doc_protocol: s.protocol,
|
|
193
|
+
doc_search: s.search,
|
|
194
|
+
doc_host: s.hostname,
|
|
195
|
+
doc_path: s.pathname,
|
|
196
|
+
title: n.title ?? document?.title,
|
|
152
197
|
locale_id: c
|
|
153
|
-
},
|
|
198
|
+
}, u = N(s);
|
|
154
199
|
return {
|
|
155
|
-
...
|
|
156
|
-
page:
|
|
157
|
-
...Object.keys(
|
|
200
|
+
...e,
|
|
201
|
+
page: i,
|
|
202
|
+
...Object.keys(u).length > 0 && { utm: u },
|
|
158
203
|
// Only include custom if there are user-provided properties
|
|
159
204
|
...Object.keys(r).length > 0 && { custom: r },
|
|
160
|
-
local_time:
|
|
205
|
+
local_time: t
|
|
161
206
|
};
|
|
162
207
|
};
|
|
163
|
-
function
|
|
164
|
-
let
|
|
165
|
-
return (...
|
|
166
|
-
const
|
|
167
|
-
|
|
208
|
+
function $(e, s) {
|
|
209
|
+
let t = 0;
|
|
210
|
+
return (...o) => {
|
|
211
|
+
const n = Date.now();
|
|
212
|
+
n - t >= s && (e(...o), t = n);
|
|
168
213
|
};
|
|
169
214
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
215
|
+
function F(e) {
|
|
216
|
+
return e.dataset.dotIdentifier || null;
|
|
172
217
|
}
|
|
173
|
-
function
|
|
218
|
+
function Y(e) {
|
|
174
219
|
return {
|
|
175
|
-
identifier:
|
|
176
|
-
inode:
|
|
177
|
-
contentType:
|
|
178
|
-
title:
|
|
179
|
-
baseType:
|
|
220
|
+
identifier: e.dataset.dotIdentifier || "",
|
|
221
|
+
inode: e.dataset.dotInode || "",
|
|
222
|
+
contentType: e.dataset.dotType || "",
|
|
223
|
+
title: e.dataset.dotTitle || "",
|
|
224
|
+
baseType: e.dataset.dotBasetype || ""
|
|
180
225
|
};
|
|
181
226
|
}
|
|
182
|
-
const z = 100,
|
|
183
|
-
const
|
|
184
|
-
r.some((
|
|
185
|
-
...Array.from(
|
|
186
|
-
...Array.from(
|
|
187
|
-
].some((
|
|
188
|
-
if (
|
|
227
|
+
const z = 100, P = () => typeof window < "u" && typeof document < "u", V = () => Array.from(document.querySelectorAll(`.${m}`)), J = (e, s = T) => {
|
|
228
|
+
const t = $(e, s), o = new MutationObserver((r) => {
|
|
229
|
+
r.some((i) => i.addedNodes.length === 0 && i.removedNodes.length === 0 ? !1 : [
|
|
230
|
+
...Array.from(i.addedNodes),
|
|
231
|
+
...Array.from(i.removedNodes)
|
|
232
|
+
].some((a) => {
|
|
233
|
+
if (a.nodeType !== Node.ELEMENT_NODE)
|
|
189
234
|
return !1;
|
|
190
|
-
const
|
|
191
|
-
return
|
|
192
|
-
})) &&
|
|
193
|
-
}),
|
|
194
|
-
return
|
|
235
|
+
const l = a;
|
|
236
|
+
return l.classList?.contains(m) ? !0 : l.querySelector?.(`.${m}`) !== null;
|
|
237
|
+
})) && t();
|
|
238
|
+
}), n = document.body || document.documentElement;
|
|
239
|
+
return n ? o.observe(n, {
|
|
195
240
|
childList: !0,
|
|
196
241
|
subtree: !0,
|
|
197
242
|
attributes: !1,
|
|
198
243
|
characterData: !1
|
|
199
244
|
}) : window.addEventListener("DOMContentLoaded", () => {
|
|
200
|
-
document.body &&
|
|
245
|
+
document.body && o.observe(document.body, {
|
|
201
246
|
childList: !0,
|
|
202
247
|
subtree: !0,
|
|
203
248
|
attributes: !1,
|
|
204
249
|
characterData: !1
|
|
205
250
|
});
|
|
206
|
-
}),
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
const
|
|
211
|
-
return new
|
|
212
|
-
}, W = (
|
|
213
|
-
|
|
214
|
-
|
|
251
|
+
}), o;
|
|
252
|
+
}, H = (e) => {
|
|
253
|
+
P() && (window.addEventListener("beforeunload", e), window.addEventListener("pagehide", e));
|
|
254
|
+
}, K = (e, s) => {
|
|
255
|
+
const t = s.logLevel ?? (s.debug ? "debug" : "warn");
|
|
256
|
+
return new v("Analytics", e, t);
|
|
257
|
+
}, W = (e, s, t) => [
|
|
258
|
+
e.impressions && s(e),
|
|
259
|
+
e.clicks && t(e)
|
|
215
260
|
].filter(Boolean);
|
|
261
|
+
function y(e) {
|
|
262
|
+
if (typeof e != "object" || e === null)
|
|
263
|
+
return {};
|
|
264
|
+
const s = {}, t = e;
|
|
265
|
+
if (typeof t.server == "string" && t.server.trim().length > 0 && (s.server = t.server.trim()), typeof t.siteAuth == "string" && t.siteAuth.trim().length > 0 && (s.siteAuth = t.siteAuth.trim()), t.queue !== void 0) {
|
|
266
|
+
if (typeof t.queue == "boolean")
|
|
267
|
+
s.queue = t.queue;
|
|
268
|
+
else if (typeof t.queue == "object" && t.queue !== null) {
|
|
269
|
+
const n = {};
|
|
270
|
+
typeof t.queue.eventBatchSize == "number" && (n.eventBatchSize = t.queue.eventBatchSize), typeof t.queue.flushInterval == "number" && (n.flushInterval = t.queue.flushInterval), Object.keys(n).length > 0 && (s.queue = n);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (t.impressions !== void 0) {
|
|
274
|
+
if (typeof t.impressions == "boolean")
|
|
275
|
+
s.impressions = t.impressions;
|
|
276
|
+
else if (typeof t.impressions == "object" && t.impressions !== null) {
|
|
277
|
+
const n = {};
|
|
278
|
+
typeof t.impressions.visibilityThreshold == "number" && (n.visibilityThreshold = t.impressions.visibilityThreshold), typeof t.impressions.dwellMs == "number" && (n.dwellMs = t.impressions.dwellMs), typeof t.impressions.maxNodes == "number" && (n.maxNodes = t.impressions.maxNodes), typeof t.impressions.throttleMs == "number" && (n.throttleMs = t.impressions.throttleMs), Object.keys(n).length > 0 && (s.impressions = n);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
typeof t.clicks == "boolean" && (s.clicks = t.clicks), typeof t.autoPageView == "boolean" && (s.autoPageView = t.autoPageView), typeof t.debug == "boolean" && (s.debug = t.debug);
|
|
282
|
+
const o = ["debug", "info", "warn", "error"];
|
|
283
|
+
return typeof t.logLevel == "string" && o.includes(t.logLevel) && (s.logLevel = t.logLevel), s;
|
|
284
|
+
}
|
|
216
285
|
export {
|
|
217
286
|
z as INITIAL_SCAN_DELAY_MS,
|
|
218
287
|
J as createContentletObserver,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
288
|
+
K as createPluginLogger,
|
|
289
|
+
$ as createThrottle,
|
|
290
|
+
j as enrichPagePayloadOptimized,
|
|
291
|
+
Y as extractContentletData,
|
|
292
|
+
F as extractContentletIdentifier,
|
|
293
|
+
N as extractUTMParameters,
|
|
294
|
+
V as findContentlets,
|
|
295
|
+
f as generateSecureId,
|
|
296
|
+
B as getAnalyticsConfig,
|
|
297
|
+
k as getAnalyticsContext,
|
|
298
|
+
M as getDeviceDataForContext,
|
|
229
299
|
W as getEnhancedTrackingPlugins,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
300
|
+
L as getLocalTime,
|
|
301
|
+
E as getSessionId,
|
|
302
|
+
C as getUserId,
|
|
303
|
+
P as isBrowser,
|
|
304
|
+
x as safeSessionStorage,
|
|
305
|
+
H as setupPluginCleanup,
|
|
306
|
+
R as validateAnalyticsConfig
|
|
237
307
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useMemo as c, useCallback as r } from "react";
|
|
2
2
|
import { getUVEState as l } from "../../../uve/src/lib/core/core.utils.js";
|
|
3
|
-
import "../../../uve/src/internal/constants.js";
|
|
4
3
|
import { initializeAnalytics as u } from "../internal/utils.js";
|
|
5
4
|
const A = {
|
|
6
5
|
track: () => {
|
|
@@ -9,7 +8,7 @@ const A = {
|
|
|
9
8
|
},
|
|
10
9
|
conversion: () => {
|
|
11
10
|
}
|
|
12
|
-
},
|
|
11
|
+
}, f = (i) => {
|
|
13
12
|
const t = c(() => {
|
|
14
13
|
const e = u(i);
|
|
15
14
|
return e || (l() ? console.warn(
|
|
@@ -20,12 +19,12 @@ const A = {
|
|
|
20
19
|
}, [i.server, i.siteAuth]);
|
|
21
20
|
if (!t)
|
|
22
21
|
return A;
|
|
23
|
-
const
|
|
22
|
+
const s = r(
|
|
24
23
|
(e, n = {}) => {
|
|
25
24
|
t.track(e, n);
|
|
26
25
|
},
|
|
27
26
|
[t]
|
|
28
|
-
),
|
|
27
|
+
), o = r(
|
|
29
28
|
(e = {}) => {
|
|
30
29
|
t.pageView(e);
|
|
31
30
|
},
|
|
@@ -37,11 +36,11 @@ const A = {
|
|
|
37
36
|
[t]
|
|
38
37
|
);
|
|
39
38
|
return {
|
|
40
|
-
track:
|
|
41
|
-
pageView:
|
|
39
|
+
track: s,
|
|
40
|
+
pageView: o,
|
|
42
41
|
conversion: a
|
|
43
42
|
};
|
|
44
43
|
};
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
f as useContentAnalytics
|
|
47
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/analytics",
|
|
3
|
-
"version": "26.9.
|
|
3
|
+
"version": "26.9.18-1-next.2741",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "Official JavaScript library for Content Analytics with DotCMS.",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -28,10 +29,11 @@
|
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
30
31
|
"react": "^18 || ^19",
|
|
31
|
-
"@dotcms/uve": "26.9.
|
|
32
|
+
"@dotcms/uve": "26.9.18-1-next.2741",
|
|
33
|
+
"next": ">=13"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@dotcms/types": "26.9.
|
|
36
|
+
"@dotcms/types": "26.9.18-1-next.2741",
|
|
35
37
|
"@testing-library/jest-dom": "^6.1.6",
|
|
36
38
|
"@testing-library/react": "^14.0.0",
|
|
37
39
|
"vite": "~5.0.0"
|
|
@@ -50,13 +52,23 @@
|
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
54
|
"exports": {
|
|
55
|
+
"./package.json": "./package.json",
|
|
53
56
|
".": {
|
|
54
|
-
"
|
|
55
|
-
"
|
|
57
|
+
"types": "./index.d.ts",
|
|
58
|
+
"import": "./index.js"
|
|
56
59
|
},
|
|
57
60
|
"./react": {
|
|
58
|
-
"
|
|
59
|
-
"
|
|
61
|
+
"types": "./lib/react/index.d.ts",
|
|
62
|
+
"import": "./react/index.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"sideEffects": false,
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"next": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"react": {
|
|
71
|
+
"optional": true
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
74
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N = /* @__PURE__ */ ((I) => (I.EDIT = "EDIT_MODE", I.PREVIEW = "PREVIEW_MODE", I.LIVE = "LIVE", I.UNKNOWN = "UNKNOWN", I))(N || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
r as UVE_MODE
|
|
3
|
+
N as UVE_MODE
|
|
5
4
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UVE_MODE as t } from "../../../../types/src/lib/editor/public.js";
|
|
2
|
-
|
|
3
|
-
function p() {
|
|
2
|
+
function g() {
|
|
4
3
|
if (typeof window > "u" || window.parent === window || !window.location)
|
|
5
4
|
return;
|
|
6
5
|
const e = new URL(window.location.href), o = Object.values(t);
|
|
@@ -17,5 +16,5 @@ function p() {
|
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
export {
|
|
20
|
-
|
|
19
|
+
g as getUVEState
|
|
21
20
|
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var u = /* @__PURE__ */ ((e) => (e.UVE_RELOAD_PAGE = "uve-reload-page", e.UVE_FLUSH_BOUNDS = "uve-flush-bounds", e.UVE_REQUEST_BOUNDS = "uve-request-bounds", e.UVE_EDITOR_PONG = "uve-editor-pong", e.UVE_SCROLL_INSIDE_IFRAME = "uve-scroll-inside-iframe", e.UVE_SET_PAGE_DATA = "uve-set-page-data", e.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS = "uve-copy-contentlet-inline-editing-success", e.UVE_SCROLL_TO_SECTION = "uve-scroll-to-section", e.UVE_SELECTION_CLEARED = "uve-selection-cleared", e))(u || {});
|
|
2
|
-
export {
|
|
3
|
-
u as __DOTCMS_UVE_EVENT__
|
|
4
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UVEEventType as e } from "../../../types/src/lib/editor/public.js";
|
|
2
|
-
import { onAutoBounds as o, onScrollToSection as r, onContentletClicked as t, onContentletHovered as E, onIframeScroll as C, onPageReload as T, onContentChanges as O } from "./events.js";
|
|
3
|
-
e.CONTENT_CHANGES + "", e.PAGE_RELOAD + "", e.IFRAME_SCROLL + "", e.CONTENTLET_HOVERED + "", e.CONTENTLET_CLICKED + "", e.SCROLL_TO_SECTION + "", e.SELECTION_CLEARED + "", e.AUTO_BOUNDS + "";
|
|
4
|
-
const L = "dot-section-";
|
|
5
|
-
export {
|
|
6
|
-
L as DOT_SECTION_ID_PREFIX
|
|
7
|
-
};
|