@rakutenanalytics/rat-react 0.3.1-rc.716ed0a
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/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/index.js +1916 -0
- package/dist/lib/TrackerProvider.d.ts +49 -0
- package/dist/lib/VisibilityTracker.d.ts +48 -0
- package/dist/lib/constants.d.ts +10 -0
- package/dist/lib/createTracker.d.ts +10 -0
- package/dist/lib/hooks/useVisibility.d.ts +9 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/useTracker.d.ts +32 -0
- package/dist/lib/useTrackerContext.d.ts +42 -0
- package/package.json +33 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1916 @@
|
|
|
1
|
+
import { useState as F, useEffect as R, createContext as se, useContext as ce, useRef as K, useCallback as _e } from "react";
|
|
2
|
+
import { jsx as z } from "react/jsx-runtime";
|
|
3
|
+
var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[e] = s, P = (n, e, s) => pe(n, typeof e != "symbol" ? e + "" : e, s), k, X = -1, S = function(n) {
|
|
4
|
+
addEventListener("pageshow", function(e) {
|
|
5
|
+
e.persisted && (X = e.timeStamp, n(e));
|
|
6
|
+
}, !0);
|
|
7
|
+
}, D = function() {
|
|
8
|
+
var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
9
|
+
if (n && n.responseStart > 0 && n.responseStart < performance.now()) return n;
|
|
10
|
+
}, O = function() {
|
|
11
|
+
var n = D();
|
|
12
|
+
return n && n.activationStart || 0;
|
|
13
|
+
}, T = function(n, e) {
|
|
14
|
+
var s = D(), _ = "navigate";
|
|
15
|
+
return X >= 0 ? _ = "back-forward-cache" : s && (document.prerendering || O() > 0 ? _ = "prerender" : document.wasDiscarded ? _ = "restore" : s.type && (_ = s.type.replace(/_/g, "-"))), { name: n, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: _ };
|
|
16
|
+
}, v = function(n, e, s) {
|
|
17
|
+
try {
|
|
18
|
+
if (PerformanceObserver.supportedEntryTypes.includes(n)) {
|
|
19
|
+
var _ = new PerformanceObserver(function(t) {
|
|
20
|
+
Promise.resolve().then(function() {
|
|
21
|
+
e(t.getEntries());
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
return _.observe(Object.assign({ type: n, buffered: !0 }, s || {})), _;
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}, d = function(n, e, s, _) {
|
|
29
|
+
var t, r;
|
|
30
|
+
return function(a) {
|
|
31
|
+
e.value >= 0 && (a || _) && ((r = e.value - (t || 0)) || t === void 0) && (t = e.value, e.delta = r, e.rating = (function(i, o) {
|
|
32
|
+
return i > o[1] ? "poor" : i > o[0] ? "needs-improvement" : "good";
|
|
33
|
+
})(e.value, s), n(e));
|
|
34
|
+
};
|
|
35
|
+
}, B = function(n) {
|
|
36
|
+
requestAnimationFrame(function() {
|
|
37
|
+
return requestAnimationFrame(function() {
|
|
38
|
+
return n();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}, N = function(n) {
|
|
42
|
+
document.addEventListener("visibilitychange", function() {
|
|
43
|
+
document.visibilityState === "hidden" && n();
|
|
44
|
+
});
|
|
45
|
+
}, H = function(n) {
|
|
46
|
+
var e = !1;
|
|
47
|
+
return function() {
|
|
48
|
+
e || (n(), e = !0);
|
|
49
|
+
};
|
|
50
|
+
}, E = -1, W = function() {
|
|
51
|
+
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
52
|
+
}, L = function(n) {
|
|
53
|
+
document.visibilityState === "hidden" && E > -1 && (E = n.type === "visibilitychange" ? n.timeStamp : 0, le());
|
|
54
|
+
}, G = function() {
|
|
55
|
+
addEventListener("visibilitychange", L, !0), addEventListener("prerenderingchange", L, !0);
|
|
56
|
+
}, le = function() {
|
|
57
|
+
removeEventListener("visibilitychange", L, !0), removeEventListener("prerenderingchange", L, !0);
|
|
58
|
+
}, J = function() {
|
|
59
|
+
return E < 0 && (E = W(), G(), S(function() {
|
|
60
|
+
setTimeout(function() {
|
|
61
|
+
E = W(), G();
|
|
62
|
+
}, 0);
|
|
63
|
+
})), { get firstHiddenTime() {
|
|
64
|
+
return E;
|
|
65
|
+
} };
|
|
66
|
+
}, b = function(n) {
|
|
67
|
+
document.prerendering ? addEventListener("prerenderingchange", function() {
|
|
68
|
+
return n();
|
|
69
|
+
}, !0) : n();
|
|
70
|
+
}, j = [1800, 3e3], $ = function(n, e) {
|
|
71
|
+
e = e || {}, b(function() {
|
|
72
|
+
var s, _ = J(), t = T("FCP"), r = v("paint", function(a) {
|
|
73
|
+
a.forEach(function(i) {
|
|
74
|
+
i.name === "first-contentful-paint" && (r.disconnect(), i.startTime < _.firstHiddenTime && (t.value = Math.max(i.startTime - O(), 0), t.entries.push(i), s(!0)));
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
r && (s = d(n, t, j, e.reportAllChanges), S(function(a) {
|
|
78
|
+
t = T("FCP"), s = d(n, t, j, e.reportAllChanges), B(function() {
|
|
79
|
+
t.value = performance.now() - a.timeStamp, s(!0);
|
|
80
|
+
});
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
}, Y = [0.1, 0.25], me = function(n, e) {
|
|
84
|
+
e = e || {}, $(H(function() {
|
|
85
|
+
var s, _ = T("CLS", 0), t = 0, r = [], a = function(o) {
|
|
86
|
+
o.forEach(function(c) {
|
|
87
|
+
if (!c.hadRecentInput) {
|
|
88
|
+
var u = r[0], l = r[r.length - 1];
|
|
89
|
+
t && c.startTime - l.startTime < 1e3 && c.startTime - u.startTime < 5e3 ? (t += c.value, r.push(c)) : (t = c.value, r = [c]);
|
|
90
|
+
}
|
|
91
|
+
}), t > _.value && (_.value = t, _.entries = r, s());
|
|
92
|
+
}, i = v("layout-shift", a);
|
|
93
|
+
i && (s = d(n, _, Y, e.reportAllChanges), N(function() {
|
|
94
|
+
a(i.takeRecords()), s(!0);
|
|
95
|
+
}), S(function() {
|
|
96
|
+
t = 0, _ = T("CLS", 0), s = d(n, _, Y, e.reportAllChanges), B(function() {
|
|
97
|
+
return s();
|
|
98
|
+
});
|
|
99
|
+
}), setTimeout(s, 0));
|
|
100
|
+
}));
|
|
101
|
+
}, Z = 0, w = 1 / 0, C = 0, he = function(n) {
|
|
102
|
+
n.forEach(function(e) {
|
|
103
|
+
e.interactionId && (w = Math.min(w, e.interactionId), C = Math.max(C, e.interactionId), Z = C ? (C - w) / 7 + 1 : 0);
|
|
104
|
+
});
|
|
105
|
+
}, ee = function() {
|
|
106
|
+
return k ? Z : performance.interactionCount || 0;
|
|
107
|
+
}, ge = function() {
|
|
108
|
+
"interactionCount" in performance || k || (k = v("event", he, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
109
|
+
}, g = [], A = /* @__PURE__ */ new Map(), te = 0, Te = function() {
|
|
110
|
+
var n = Math.min(g.length - 1, Math.floor((ee() - te) / 50));
|
|
111
|
+
return g[n];
|
|
112
|
+
}, de = [], fe = function(n) {
|
|
113
|
+
if (de.forEach(function(t) {
|
|
114
|
+
return t(n);
|
|
115
|
+
}), n.interactionId || n.entryType === "first-input") {
|
|
116
|
+
var e = g[g.length - 1], s = A.get(n.interactionId);
|
|
117
|
+
if (s || g.length < 10 || n.duration > e.latency) {
|
|
118
|
+
if (s) n.duration > s.latency ? (s.entries = [n], s.latency = n.duration) : n.duration === s.latency && n.startTime === s.entries[0].startTime && s.entries.push(n);
|
|
119
|
+
else {
|
|
120
|
+
var _ = { id: n.interactionId, latency: n.duration, entries: [n] };
|
|
121
|
+
A.set(_.id, _), g.push(_);
|
|
122
|
+
}
|
|
123
|
+
g.sort(function(t, r) {
|
|
124
|
+
return r.latency - t.latency;
|
|
125
|
+
}), g.length > 10 && g.splice(10).forEach(function(t) {
|
|
126
|
+
return A.delete(t.id);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, re = function(n) {
|
|
131
|
+
var e = self.requestIdleCallback || self.setTimeout, s = -1;
|
|
132
|
+
return n = H(n), document.visibilityState === "hidden" ? n() : (s = e(n), N(n)), s;
|
|
133
|
+
}, Q = [200, 500], ye = function(n, e) {
|
|
134
|
+
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, b(function() {
|
|
135
|
+
var s;
|
|
136
|
+
ge();
|
|
137
|
+
var _, t = T("INP"), r = function(i) {
|
|
138
|
+
re(function() {
|
|
139
|
+
i.forEach(fe);
|
|
140
|
+
var o = Te();
|
|
141
|
+
o && o.latency !== t.value && (t.value = o.latency, t.entries = o.entries, _());
|
|
142
|
+
});
|
|
143
|
+
}, a = v("event", r, { durationThreshold: (s = e.durationThreshold) !== null && s !== void 0 ? s : 40 });
|
|
144
|
+
_ = d(n, t, Q, e.reportAllChanges), a && (a.observe({ type: "first-input", buffered: !0 }), N(function() {
|
|
145
|
+
r(a.takeRecords()), _(!0);
|
|
146
|
+
}), S(function() {
|
|
147
|
+
te = ee(), g.length = 0, A.clear(), t = T("INP"), _ = d(n, t, Q, e.reportAllChanges);
|
|
148
|
+
}));
|
|
149
|
+
}));
|
|
150
|
+
}, x = [2500, 4e3], V = {}, Ee = function(n, e) {
|
|
151
|
+
e = e || {}, b(function() {
|
|
152
|
+
var s, _ = J(), t = T("LCP"), r = function(o) {
|
|
153
|
+
e.reportAllChanges || (o = o.slice(-1)), o.forEach(function(c) {
|
|
154
|
+
c.startTime < _.firstHiddenTime && (t.value = Math.max(c.startTime - O(), 0), t.entries = [c], s());
|
|
155
|
+
});
|
|
156
|
+
}, a = v("largest-contentful-paint", r);
|
|
157
|
+
if (a) {
|
|
158
|
+
s = d(n, t, x, e.reportAllChanges);
|
|
159
|
+
var i = H(function() {
|
|
160
|
+
V[t.id] || (r(a.takeRecords()), a.disconnect(), V[t.id] = !0, s(!0));
|
|
161
|
+
});
|
|
162
|
+
["keydown", "click"].forEach(function(o) {
|
|
163
|
+
addEventListener(o, function() {
|
|
164
|
+
return re(i);
|
|
165
|
+
}, { once: !0, capture: !0 });
|
|
166
|
+
}), N(i), S(function(o) {
|
|
167
|
+
t = T("LCP"), s = d(n, t, x, e.reportAllChanges), B(function() {
|
|
168
|
+
t.value = performance.now() - o.timeStamp, V[t.id] = !0, s(!0);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}, q = [800, 1800], Se = function n(e) {
|
|
174
|
+
document.prerendering ? b(function() {
|
|
175
|
+
return n(e);
|
|
176
|
+
}) : document.readyState !== "complete" ? addEventListener("load", function() {
|
|
177
|
+
return n(e);
|
|
178
|
+
}, !0) : setTimeout(e, 0);
|
|
179
|
+
}, Pe = function(n, e) {
|
|
180
|
+
e = e || {};
|
|
181
|
+
var s = T("TTFB"), _ = d(n, s, q, e.reportAllChanges);
|
|
182
|
+
Se(function() {
|
|
183
|
+
var t = D();
|
|
184
|
+
t && (s.value = Math.max(t.responseStart - O(), 0), s.entries = [t], _(!0), S(function() {
|
|
185
|
+
s = T("TTFB", 0), (_ = d(n, s, q, e.reportAllChanges))(!0);
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
function ve(n = []) {
|
|
190
|
+
const e = {};
|
|
191
|
+
e.ParameterTypes = {
|
|
192
|
+
/** Account ID. */
|
|
193
|
+
ACCOUNT_ID: "acc",
|
|
194
|
+
/** GPS Accuracy, in metres. */
|
|
195
|
+
ACCURACY: "accu",
|
|
196
|
+
/** Advertising id from apps. */
|
|
197
|
+
AD_COOKIE: "cka",
|
|
198
|
+
/** Affiliate ID. */
|
|
199
|
+
AFFILIATE_ID: "afid",
|
|
200
|
+
/** GPS Altitude, in metres. */
|
|
201
|
+
ALTITUDE: "altitude",
|
|
202
|
+
/** GPS Altitude accuracy, in metres. */
|
|
203
|
+
ALTITUDE_ACCURACY: "altaccu",
|
|
204
|
+
/** Parameter for first party tracking cookie. */
|
|
205
|
+
ANALYTICS_COOKIE: "_ra",
|
|
206
|
+
/** Page async load timing (ms). */
|
|
207
|
+
ASYNC_TIMING: "astime",
|
|
208
|
+
/** Browser language, in ISO-639 format. */
|
|
209
|
+
BROWSER_LANGUAGE: "bln",
|
|
210
|
+
/** Campaign code. */
|
|
211
|
+
CAMPAIGN_CODE: "cc",
|
|
212
|
+
/** Character set in use by the browser. */
|
|
213
|
+
CHARSET: "tis",
|
|
214
|
+
/** Checkout stage. */
|
|
215
|
+
CHECKOUT: "chkout",
|
|
216
|
+
/** Checkpoints. */
|
|
217
|
+
CHECKPOINTS: "chkpt",
|
|
218
|
+
/** Content language, in ISO-639 format. */
|
|
219
|
+
CONTENT_LANGUAGE: "cntln",
|
|
220
|
+
/** Currency code, in ISO-4217 format. */
|
|
221
|
+
CURRENCY: "cycode",
|
|
222
|
+
/** Custom parameters. */
|
|
223
|
+
CUSTOM: "cp",
|
|
224
|
+
/** Debug parameters. */
|
|
225
|
+
DEBUG: "debug",
|
|
226
|
+
/** Type of event. */
|
|
227
|
+
EVENT_TYPE: "etype",
|
|
228
|
+
/** Adobe Flash(tm) version. */
|
|
229
|
+
FLASH_VERSION: "flv",
|
|
230
|
+
/** Item genre. */
|
|
231
|
+
GENRE: "genre",
|
|
232
|
+
/** Goal ID. */
|
|
233
|
+
GOAL_ID: "gol",
|
|
234
|
+
/** GPS Timestamp. */
|
|
235
|
+
GPS_TIMESTAMP: "tms",
|
|
236
|
+
/** GPS Heading, in degrees. */
|
|
237
|
+
HEADING: "head",
|
|
238
|
+
/** Iframe status */
|
|
239
|
+
IFRAME_STATUS: "ifr",
|
|
240
|
+
/** Oracle Java(tm) presence flag. */
|
|
241
|
+
JAVA_PRESENT: "jav",
|
|
242
|
+
/** GPS Latitude, in degrees North. */
|
|
243
|
+
LATITUDE: "lat",
|
|
244
|
+
/** Page load timing (ms). */
|
|
245
|
+
LOAD_TIMING: "ldtime",
|
|
246
|
+
/** GPS Position container. */
|
|
247
|
+
LOCATION: "loc",
|
|
248
|
+
/** GPS Longitude, in degrees West. */
|
|
249
|
+
LONGITUDE: "long",
|
|
250
|
+
/** Navigation type */
|
|
251
|
+
NAV_TYPE: "navtype",
|
|
252
|
+
/** Online flag. */
|
|
253
|
+
ONLINE_STATUS: "online",
|
|
254
|
+
/** Page id. */
|
|
255
|
+
PAGE_ID: "pgid",
|
|
256
|
+
/** Page layout (PC/SP/TB) */
|
|
257
|
+
PAGE_LAYOUT: "pgl",
|
|
258
|
+
/** Page name. */
|
|
259
|
+
PAGE_NAME: "pgn",
|
|
260
|
+
/** Page type. */
|
|
261
|
+
PAGE_TYPE: "pgt",
|
|
262
|
+
/** Persistent cookie. */
|
|
263
|
+
PERSISTENT_COOKIE: "ckp",
|
|
264
|
+
/** HTTP Referrer URL. */
|
|
265
|
+
REFERRER: "ref",
|
|
266
|
+
/** HTTP URL. */
|
|
267
|
+
URL: "url",
|
|
268
|
+
/** Request result. */
|
|
269
|
+
REQUEST_RESULT: "reqc",
|
|
270
|
+
/** HTTP request timing (ms). */
|
|
271
|
+
REQUEST_TIMING: "rqtime",
|
|
272
|
+
/** Window size, in WxH string format. */
|
|
273
|
+
RESOLUTION: "res",
|
|
274
|
+
/** Script load timestamp. */
|
|
275
|
+
SCRIPT_START_TIME: "ltm",
|
|
276
|
+
/** Type of SDK. */
|
|
277
|
+
SDK_SOURCE: "sdk_source",
|
|
278
|
+
/** Search query fields. */
|
|
279
|
+
SEARCH_QUERY: "sq",
|
|
280
|
+
/** Service ID. */
|
|
281
|
+
SERVICE_ID: "aid",
|
|
282
|
+
/** Session cookie. */
|
|
283
|
+
SESSION_COOKIE: "cks",
|
|
284
|
+
/** Session cookie v2. */
|
|
285
|
+
SESSION_COOKIE_2: "cks2",
|
|
286
|
+
/** Session cookie persistence flag. */
|
|
287
|
+
SESSION_COOKIE_FLAG: "use_cks",
|
|
288
|
+
/** GPS Speed, in m/s. */
|
|
289
|
+
SPEED: "speed",
|
|
290
|
+
/** Browser timezone. */
|
|
291
|
+
TIMEZONE: "tzo",
|
|
292
|
+
/** Total Page Load Time */
|
|
293
|
+
TOTAL_PAGE_LOAD_TIME: "tpgldtime",
|
|
294
|
+
/** Browser user agent string. */
|
|
295
|
+
USER_AGENT: "ua",
|
|
296
|
+
/** Analytics parameters version. */
|
|
297
|
+
VERSION: "ver",
|
|
298
|
+
/** List of items that have been shown. */
|
|
299
|
+
VIEW_IMPRESSIONS: "sresv",
|
|
300
|
+
/** Tab Id. */
|
|
301
|
+
TAB_ID: "tid",
|
|
302
|
+
/** Web Vitals Metric: first content paint */
|
|
303
|
+
WEB_VITALS_FCP: "wv_fcp",
|
|
304
|
+
/** Web Vitals Metric: largest content paint */
|
|
305
|
+
WEB_VITALS_LCP: "wv_lcp",
|
|
306
|
+
/** Web Vitals Metric: interaction to next paint */
|
|
307
|
+
WEB_VITALS_INP: "wv_inp",
|
|
308
|
+
/** Web Vitals Metric: time to first byte */
|
|
309
|
+
WEB_VITALS_TTFB: "wv_ttfb",
|
|
310
|
+
/** Web Vitals Metric: cumulative layout shift */
|
|
311
|
+
WEB_VITALS_CLS: "wv_cls",
|
|
312
|
+
/** Web Vitals Script Version */
|
|
313
|
+
WEB_VITALS_SCRIPT_VERSION: "wv_ver",
|
|
314
|
+
/** Web Vitals unique identifier */
|
|
315
|
+
WEB_VITALS_UNIQUE_IDENTIFIER: "wv_uid",
|
|
316
|
+
/**
|
|
317
|
+
* NOTE:
|
|
318
|
+
* Commented out Low Entropy User-agent client hint values: Brands, Mobile, Platform
|
|
319
|
+
* Due to values being complemented on the receiver side
|
|
320
|
+
*/
|
|
321
|
+
/** User-agent client hints: Brands */
|
|
322
|
+
// UACH_BRANDS: "uach",
|
|
323
|
+
/** User-agent client hints: Mobile */
|
|
324
|
+
// UACH_MOBILE: "uach_mobile",
|
|
325
|
+
/** User-agent client hints: Platform */
|
|
326
|
+
// UACH_PLATFORM: "uach_platform",
|
|
327
|
+
/** High Entropy User-agent client hint values */
|
|
328
|
+
/** User-agent client hints: Architecture */
|
|
329
|
+
UACH_ARCHITECTURE: "uach_arch",
|
|
330
|
+
/** User-agent client hints: Bitness */
|
|
331
|
+
UACH_BITNESS: "uach_bitness",
|
|
332
|
+
/** User-agent client hints: Full version list */
|
|
333
|
+
UACH_FULL_VERSION_LIST: "uach_full_version_list",
|
|
334
|
+
/** User-agent client hints: Model */
|
|
335
|
+
UACH_MODEL: "uach_model",
|
|
336
|
+
/** User-agent client hints: Platform version */
|
|
337
|
+
UACH_PLATFORM_VERSION: "uach_platform_version",
|
|
338
|
+
/** User-agent client hints: Wow64 */
|
|
339
|
+
UACH_WOW64: "uach_wow64"
|
|
340
|
+
}, e._DEFAULT_VERSION = "1.11.0", e._DEFAULT_SDK_SOURCE = "ral", e._UNKNOWN_BROWSER_LANGUAGE = "OO1OO", e._DEFAULT_ANALYTICS_INTERVAL = 500, e._DEFAULT_ANALYTICS_COOKIE = "_ra", e._DEFAULT_COOKIE_DURATION_DAYS = 365 * 2, e._KEY_PREFIX_MARKER = "RAL", e._OFFLINE_STORAGE_KEY = "ROFL", e._TAB_ID_KEY = "RTID", e._FPRINT_KEY = "RFPR", e._POST_RAW_REQUEST_PARAMETER = "cpkg_none=", e._GET_RAW_REQUEST_PARAMETER = "?" + e._POST_RAW_REQUEST_PARAMETER, e._RECORDS_LIMIT_COUNT = 256, e._RECORDS_LIMIT_TOTAL_SIZE = 256 * 1024, e._RECORDS_CHUNK_LENGTH = 16, e._WEB_VITALS = null, e._WEB_VITALS_SCRIPT_VERSION = "4.2.3", e._WEB_VITALS_SAMPLING_RATIO = 1e-3, e._DEFAULT_SERVICE_ID = 1, e._EVENT_MERGE_FLAGS = {
|
|
341
|
+
appear: !0,
|
|
342
|
+
async: !1,
|
|
343
|
+
scroll: !0,
|
|
344
|
+
click: !1,
|
|
345
|
+
pv: !1,
|
|
346
|
+
perf: !1
|
|
347
|
+
}, e._asyncDelaysFlag = !1, e._transportMethod = "xhr", e._sdkVersion = e._DEFAULT_VERSION, e._sdkSource = e._DEFAULT_SDK_SOURCE, e._UACH = (function() {
|
|
348
|
+
var t = {
|
|
349
|
+
__uach_full_version_list: void 0,
|
|
350
|
+
__uach_wow64: void 0,
|
|
351
|
+
uach_full_version_list: void 0,
|
|
352
|
+
uach_arch: void 0,
|
|
353
|
+
uach_bitness: void 0,
|
|
354
|
+
uach_model: void 0,
|
|
355
|
+
uach_platform_version: void 0,
|
|
356
|
+
uach_wow64: void 0
|
|
357
|
+
};
|
|
358
|
+
Object.defineProperties(t, {
|
|
359
|
+
uach_full_version_list: {
|
|
360
|
+
get: function() {
|
|
361
|
+
return t.__uach_full_version_list;
|
|
362
|
+
},
|
|
363
|
+
set: function(a) {
|
|
364
|
+
if (Array.isArray(a))
|
|
365
|
+
try {
|
|
366
|
+
t.__uach_full_version_list = a.reduce(function(i, o, c) {
|
|
367
|
+
return i += (c ? ", " : "") + '"' + o.brand + '";v="' + o.version + '"', i;
|
|
368
|
+
}, "");
|
|
369
|
+
} catch (i) {
|
|
370
|
+
e._log(`User-Agent Client Hint: Failed to convert fullVersionList value
|
|
371
|
+
` + i.message);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
uach_wow64: {
|
|
376
|
+
get: function() {
|
|
377
|
+
return t.__uach_wow64;
|
|
378
|
+
},
|
|
379
|
+
set: function(a) {
|
|
380
|
+
t.__uach_wow64 = (!!a).toString();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
var r = function() {
|
|
385
|
+
var a = navigator.userAgentData.getHighEntropyValues;
|
|
386
|
+
a = a.call(navigator.userAgentData, [
|
|
387
|
+
"architecture",
|
|
388
|
+
"bitness",
|
|
389
|
+
"model",
|
|
390
|
+
"platformVersion",
|
|
391
|
+
"fullVersionList",
|
|
392
|
+
"wow64"
|
|
393
|
+
]).then(function(i) {
|
|
394
|
+
i && (t[e.ParameterTypes.UACH_ARCHITECTURE] = i.architecture, t[e.ParameterTypes.UACH_BITNESS] = i.bitness, t[e.ParameterTypes.UACH_FULL_VERSION_LIST] = i.fullVersionList, t[e.ParameterTypes.UACH_MODEL] = i.model, t[e.ParameterTypes.UACH_PLATFORM_VERSION] = i.platformVersion, t[e.ParameterTypes.UACH_WOW64] = i.wow64), e._asyncDelaysFlag = !1;
|
|
395
|
+
}), a.catch(function() {
|
|
396
|
+
e._asyncDelaysFlag = !1;
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
return "userAgentData" in navigator && "getHighEntropyValues" in navigator.userAgentData && (e._asyncDelaysFlag = !0, r(), window.addEventListener("load", function() {
|
|
400
|
+
r();
|
|
401
|
+
}), setTimeout(function() {
|
|
402
|
+
e._asyncDelaysFlag = !1;
|
|
403
|
+
}, 1e3)), t;
|
|
404
|
+
})(), e.eventLog = [], e._log = function(t) {
|
|
405
|
+
}, e._error = function(t) {
|
|
406
|
+
}, e._isString = function(t) {
|
|
407
|
+
return typeof t == "string" || Object.prototype.toString.call(t) === "[object String]";
|
|
408
|
+
}, e._trimString = function(t) {
|
|
409
|
+
return e._isString(t) ? t.replace(/^\s+|\s+$/g, "") : null;
|
|
410
|
+
}, e._isArray = function(t) {
|
|
411
|
+
return Object.prototype.toString.call(t) === "[object Array]";
|
|
412
|
+
}, e._isObject = function(t) {
|
|
413
|
+
return !!t && Object.prototype.toString.call(t) === "[object Object]";
|
|
414
|
+
}, e._mergeDictionaries = function(t, r) {
|
|
415
|
+
if (t && typeof t == "object" && r && typeof r == "object") {
|
|
416
|
+
for (var a in r)
|
|
417
|
+
t[a] = r[a];
|
|
418
|
+
return !0;
|
|
419
|
+
}
|
|
420
|
+
return !1;
|
|
421
|
+
}, e._getCookie = function(t, r) {
|
|
422
|
+
var a = e._trimString(t);
|
|
423
|
+
if (a === null)
|
|
424
|
+
return e._log("Empty cookie name!"), null;
|
|
425
|
+
r === void 0 && (r = document.cookie);
|
|
426
|
+
var i = r ? r.split(";") : "", o;
|
|
427
|
+
for (o = i.length - 1; o >= 0; o--) {
|
|
428
|
+
var c = i[o].indexOf("=");
|
|
429
|
+
if (c > 0) {
|
|
430
|
+
var u = e._trimString(i[o].substr(0, c));
|
|
431
|
+
if (u === a)
|
|
432
|
+
return i[o].substr(c + 1);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}, e._setCookie = function(t, r, a, i) {
|
|
437
|
+
var o = e._trimString(t), c = e._trimString(r), u = parseInt(a, 10);
|
|
438
|
+
if (o !== null && c !== null && !isNaN(u)) {
|
|
439
|
+
var l = /* @__PURE__ */ new Date();
|
|
440
|
+
u <= 0 ? l.setTime(0) : l.setDate(l.getDate() + u);
|
|
441
|
+
var h = location.protocol === "https:";
|
|
442
|
+
u <= 0 ? e._log('Clearing cookie "' + o + '"') : e._log("Setting " + (h ? "secure " : "") + 'cookie "' + o + '" with value "' + c + '" valid for ' + u + " days"), document.cookie = o + "=" + c + "; Expires=" + l.toGMTString() + ";" + (i ? " Domain=." + i + ";" : "") + " Path=/;" + (h ? " Secure;" : "");
|
|
443
|
+
} else
|
|
444
|
+
e._log("Cannot set cookie with empty name or value");
|
|
445
|
+
}, e._removeCookie = function(t) {
|
|
446
|
+
e._setCookie(t, "", 0);
|
|
447
|
+
}, e._createUUID = function(t, r) {
|
|
448
|
+
for (r = t = ""; t++ < 36; r += t * 51 & 52 ? (t ^ 15 ? 8 ^ Math.random() * (t ^ 20 ? 16 : 4) : 4).toString(16) : "-") ;
|
|
449
|
+
return r;
|
|
450
|
+
}, e._testCookieSupport = function(t) {
|
|
451
|
+
var r = e._KEY_PREFIX_MARKER + "TEST";
|
|
452
|
+
e._setCookie(r, r, 1, t);
|
|
453
|
+
var a = e._getCookie(r);
|
|
454
|
+
return e._setCookie(r, "", 0, t), a === r;
|
|
455
|
+
}, e._getQueryParam = function(t, r) {
|
|
456
|
+
t = e._trimString(t);
|
|
457
|
+
var a = RegExp("^" + t + "=");
|
|
458
|
+
if (r = r || document.location.search, r) {
|
|
459
|
+
for (var i = r.replace(/^\?/, "").split("&"), o = 0; o < i.length; o++)
|
|
460
|
+
if (a.test(i[o]))
|
|
461
|
+
return decodeURIComponent(i[o].substring(t.length + 1));
|
|
462
|
+
}
|
|
463
|
+
return null;
|
|
464
|
+
}, e._hash = function(t, r) {
|
|
465
|
+
if (!e._isString(t))
|
|
466
|
+
return "0000";
|
|
467
|
+
var a, i = [0, 0, 0, 0];
|
|
468
|
+
for (a = 0; a < t.length; ++a)
|
|
469
|
+
i[a % 4] += t.charCodeAt(a);
|
|
470
|
+
var o = 0;
|
|
471
|
+
for (a = 0; a < 4; ++a)
|
|
472
|
+
o = (o << 4) + i[a] % 16;
|
|
473
|
+
return r && (o = o ^ Math.floor(Math.random() * 65536)), ("0000" + o.toString(16)).slice(-4);
|
|
474
|
+
}, e._triggerCustomEvent = function(t, r) {
|
|
475
|
+
try {
|
|
476
|
+
var a;
|
|
477
|
+
if (window.CustomEvent && typeof window.CustomEvent == "function")
|
|
478
|
+
a = new CustomEvent(t, { detail: r }), document.dispatchEvent(a);
|
|
479
|
+
else if (document.createEvent)
|
|
480
|
+
a = document.createEvent("CustomEvent"), a.initCustomEvent(t, !0, !0, r), document.dispatchEvent(a);
|
|
481
|
+
else if (document.createEventObject && document.fireEvent)
|
|
482
|
+
a = document.createEventObject(), a.detail = r, document.fireEvent("onpropertychange", a);
|
|
483
|
+
else
|
|
484
|
+
throw new Error("Cannot instantiate event for " + t);
|
|
485
|
+
e._log("Event dispatched: " + t);
|
|
486
|
+
} catch (i) {
|
|
487
|
+
e._log("Failed to dispatch event: " + i.message);
|
|
488
|
+
}
|
|
489
|
+
}, e._loadWebVitals = function() {
|
|
490
|
+
return {
|
|
491
|
+
onCLS: me,
|
|
492
|
+
onINP: ye,
|
|
493
|
+
onLCP: Ee,
|
|
494
|
+
onFCP: $,
|
|
495
|
+
onTTFB: Pe
|
|
496
|
+
};
|
|
497
|
+
}, e.Transport = function(t) {
|
|
498
|
+
if (e._isArray(t))
|
|
499
|
+
this._targetUrls = t;
|
|
500
|
+
else
|
|
501
|
+
throw "Invalid target URLs";
|
|
502
|
+
}, e.Transport.prototype.addReceiver = function(t) {
|
|
503
|
+
if (e._isString(t)) {
|
|
504
|
+
t = this._normalizeScheme(t);
|
|
505
|
+
for (var r = 0; r < this._targetUrls.length; ++r)
|
|
506
|
+
if (this._targetUrls[r] === t)
|
|
507
|
+
return;
|
|
508
|
+
this._targetUrls.push(t);
|
|
509
|
+
}
|
|
510
|
+
}, e.Transport.prototype.setMainReceiver = function(t) {
|
|
511
|
+
if (e._isString(t)) {
|
|
512
|
+
t = this._normalizeScheme(t), this._targetUrls[0] = t;
|
|
513
|
+
for (var r = this._targetUrls.length - 1; r > 0; --r)
|
|
514
|
+
this._targetUrls[r] === t && this._targetUrls.splice(r, 1);
|
|
515
|
+
}
|
|
516
|
+
}, e.SendBeaconTransport = function(t) {
|
|
517
|
+
e.Transport.call(this, t);
|
|
518
|
+
}, Object.setPrototypeOf(e.SendBeaconTransport.prototype, e.Transport.prototype), e.SendBeaconTransport.prototype.send = function(t) {
|
|
519
|
+
!e._isString(t) || t.length === 0 || this._targetUrls.forEach(function(r) {
|
|
520
|
+
try {
|
|
521
|
+
window.navigator.sendBeacon(r, e._POST_RAW_REQUEST_PARAMETER + t);
|
|
522
|
+
} catch (a) {
|
|
523
|
+
e._log("Error in sending data: " + a.toString());
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
}, e.XHRTransport = function(t) {
|
|
527
|
+
e.Transport.call(this, t);
|
|
528
|
+
}, Object.setPrototypeOf(e.XHRTransport.prototype, e.Transport.prototype), e.XHRTransport.prototype._getXHRProvider = function() {
|
|
529
|
+
return window.XMLHttpRequest ? (e._log("Using W3C XMLHttpRequest"), new XMLHttpRequest()) : (e._log("No XMLHttpRequest providers found!"), null);
|
|
530
|
+
}, e.XHRTransport.prototype.send = function(t, r) {
|
|
531
|
+
var a = this, i = a._getXHRProvider();
|
|
532
|
+
i ? a._targetUrls.forEach(function(o) {
|
|
533
|
+
r === "POST" ? (i.open("POST", o, !0), i.withCredentials = !0, i.send(e._POST_RAW_REQUEST_PARAMETER + t), e._log("Upload performed successfully")) : r === "GET" ? (i.open("GET", o + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t), !0), i.withCredentials = !0, i.send("")) : e._log("Invalid XMLHttpRequest method");
|
|
534
|
+
}) : e._log("No XMLHttpRequest support, removing data");
|
|
535
|
+
}, e.ParametersContainer = function(t) {
|
|
536
|
+
this._parameters = {}, this._noMergeParameters = {}, t !== void 0 && e._mergeDictionaries(this._parameters, t);
|
|
537
|
+
}, e.ParametersContainer.prototype.clear = function() {
|
|
538
|
+
this._parameters = {}, this._noMergeParameters = {};
|
|
539
|
+
}, e.ParametersContainer.prototype._isValid = function(t) {
|
|
540
|
+
return t == null ? !1 : e._isString(t) ? e._trimString(t) !== "" : typeof t == "number" ? !isNaN(t) && isFinite(t) : !0;
|
|
541
|
+
}, e.ParametersContainer.prototype.insert = function(t, r) {
|
|
542
|
+
var a = e._trimString(t);
|
|
543
|
+
if (a === null || a === "") {
|
|
544
|
+
e._log("Empty key!");
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
a in this._parameters && e._log("Overwriting " + a), this._isValid(r) ? this._parameters[a] = typeof r == "string" ? e._trimString(r) : r : e._log("Invalid value for " + a);
|
|
548
|
+
}, e.ParametersContainer.prototype.remove = function(t) {
|
|
549
|
+
var r = e._trimString(t);
|
|
550
|
+
if (r === null || r === "") {
|
|
551
|
+
e._log("Empty key!");
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
r in this._parameters && delete this._parameters[r];
|
|
555
|
+
}, e.ParametersContainer.prototype.setParameters = function(t, r) {
|
|
556
|
+
if (!e._isObject(t)) {
|
|
557
|
+
e._log("Invalid object type");
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
for (var a in t)
|
|
561
|
+
this.insert(a, t[a]), r && (this._noMergeParameters[a] = !0);
|
|
562
|
+
}, e.ParametersContainer.prototype.mergeParameters = function(t) {
|
|
563
|
+
if (!e._isObject(t)) {
|
|
564
|
+
e._log("Invalid object type");
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
for (var r in t)
|
|
568
|
+
if (!this.hasKey(r) || this._noMergeParameters[r])
|
|
569
|
+
this.insert(r, t[r]);
|
|
570
|
+
else {
|
|
571
|
+
var a = this.get(r);
|
|
572
|
+
e._isArray(a) && e._isArray(t[r]) ? this.insert(r, a.concat(t[r])) : e._isObject(a) && e._isObject(t[r]) ? e._mergeDictionaries(a, t[r]) : this.insert(r, t[r]);
|
|
573
|
+
}
|
|
574
|
+
}, e.ParametersContainer.prototype.serialize = function() {
|
|
575
|
+
return JSON.stringify(this._parameters);
|
|
576
|
+
}, e.ParametersContainer.prototype.get = function(t) {
|
|
577
|
+
var r = e._trimString(t);
|
|
578
|
+
return r === null || r === "" ? null : r in this._parameters ? this._parameters[r] : null;
|
|
579
|
+
}, e.ParametersContainer.prototype.hasKey = function(t) {
|
|
580
|
+
var r = e._trimString(t);
|
|
581
|
+
return r === null || r === "" ? !1 : r in this._parameters;
|
|
582
|
+
}, e.ParametersContainer.prototype.clone = function() {
|
|
583
|
+
var t = {};
|
|
584
|
+
for (var r in this._parameters)
|
|
585
|
+
t[r] = this._parameters[r];
|
|
586
|
+
return t;
|
|
587
|
+
}, e.ParametersContainer.prototype.shouldMergeSeries = function() {
|
|
588
|
+
var t = !1, r = this.get(e.ParameterTypes.EVENT_TYPE);
|
|
589
|
+
return r == "scroll" ? t = e._EVENT_MERGE_FLAGS.scroll : r == "appear" ? t = e._EVENT_MERGE_FLAGS.appear : r == "pv" ? t = e._EVENT_MERGE_FLAGS.pv : r == "click" ? t = e._EVENT_MERGE_FLAGS.click : r == "async" && (t = e._EVENT_MERGE_FLAGS.async), t;
|
|
590
|
+
}, e.OfflineStorage = function() {
|
|
591
|
+
}, e.OfflineStorage.prototype.setForKey = function(t, r) {
|
|
592
|
+
}, e.OfflineStorage.prototype.getForKey = function(t) {
|
|
593
|
+
}, e.OfflineStorage.prototype.removeKey = function(t) {
|
|
594
|
+
}, e.OfflineStorage.prototype.clear = function() {
|
|
595
|
+
}, e.OfflineStorage.prototype.hasKey = function(t) {
|
|
596
|
+
}, e.CookieStorage = function() {
|
|
597
|
+
this._marker = e._KEY_PREFIX_MARKER;
|
|
598
|
+
}, e.CookieStorage.prototype.setForKey = function(t, r) {
|
|
599
|
+
if (r.length > 1e3)
|
|
600
|
+
return !1;
|
|
601
|
+
e._setCookie(this._marker + t, encodeURIComponent(String(r)), 365);
|
|
602
|
+
var a = e._getCookie(this._marker + t);
|
|
603
|
+
return a !== null && decodeURIComponent(a) === r;
|
|
604
|
+
}, e.CookieStorage.prototype.getForKey = function(t) {
|
|
605
|
+
var r = e._getCookie(this._marker + t);
|
|
606
|
+
return r == null ? null : decodeURIComponent(r);
|
|
607
|
+
}, e.CookieStorage.prototype.removeKey = function(t) {
|
|
608
|
+
e._removeCookie(this._marker + t);
|
|
609
|
+
}, e.CookieStorage.prototype.clear = function() {
|
|
610
|
+
var t = document.cookie && document.cookie.split(";"), r;
|
|
611
|
+
for (r = 0; r < t.length; r++) {
|
|
612
|
+
var a = t[r].indexOf("=");
|
|
613
|
+
if (a > 0) {
|
|
614
|
+
var i = e._trimString(t[r].substr(0, a)) || "";
|
|
615
|
+
i.indexOf(this._marker) === 0 && this.removeKey(i.substring(this._marker.length));
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}, e.CookieStorage.prototype.hasKey = function(t) {
|
|
619
|
+
return this.getForKey(t) !== null;
|
|
620
|
+
}, e.LocalStorage = function() {
|
|
621
|
+
this._marker = e._KEY_PREFIX_MARKER;
|
|
622
|
+
}, e.LocalStorage.prototype.setForKey = function(t, r) {
|
|
623
|
+
try {
|
|
624
|
+
return window.localStorage.setItem(this._marker + t, r), !0;
|
|
625
|
+
} catch (a) {
|
|
626
|
+
e._log("Could not write to local storage: " + a.toString());
|
|
627
|
+
}
|
|
628
|
+
return !1;
|
|
629
|
+
}, e.LocalStorage.prototype.getForKey = function(t) {
|
|
630
|
+
return window.localStorage.getItem(this._marker + t);
|
|
631
|
+
}, e.LocalStorage.prototype.removeKey = function(t) {
|
|
632
|
+
window.localStorage.removeItem(this._marker + t);
|
|
633
|
+
}, e.LocalStorage.prototype.clear = function() {
|
|
634
|
+
var t = [], r;
|
|
635
|
+
for (r = 0; r < window.localStorage.length; r++)
|
|
636
|
+
window.localStorage.key(r).indexOf(this._marker) === 0 && t.push(window.localStorage.key(r));
|
|
637
|
+
for (r = 0; r < t.length; r++)
|
|
638
|
+
this.removeKey(t[r].substring(this._marker.length));
|
|
639
|
+
}, e.LocalStorage.prototype.hasKey = function(t) {
|
|
640
|
+
return this.getForKey(t) !== null;
|
|
641
|
+
}, e.NullStorage = function() {
|
|
642
|
+
e._log("No storage support!");
|
|
643
|
+
}, e.NullStorage.prototype.setForKey = function(t, r) {
|
|
644
|
+
return e._log("No storage support!"), !0;
|
|
645
|
+
}, e.NullStorage.prototype.getForKey = function(t) {
|
|
646
|
+
return e._log("No storage support!"), null;
|
|
647
|
+
}, e.NullStorage.prototype.removeKey = function(t) {
|
|
648
|
+
e._log("No storage support!");
|
|
649
|
+
}, e.NullStorage.prototype.clear = function() {
|
|
650
|
+
e._log("No storage support!");
|
|
651
|
+
}, e.NullStorage.prototype.hasKey = function(t) {
|
|
652
|
+
return e._log("No storage support!"), !1;
|
|
653
|
+
}, e.RamStorage = function() {
|
|
654
|
+
this._container = {};
|
|
655
|
+
}, e.RamStorage.prototype.setForKey = function(t, r) {
|
|
656
|
+
return this._container[t] = r, !0;
|
|
657
|
+
}, e.RamStorage.prototype.getForKey = function(t) {
|
|
658
|
+
return t in this._container ? this._container[t] : null;
|
|
659
|
+
}, e.RamStorage.prototype.removeKey = function(t) {
|
|
660
|
+
t in this._container && delete this._container[t];
|
|
661
|
+
}, e.RamStorage.prototype.clear = function() {
|
|
662
|
+
this._container = {};
|
|
663
|
+
}, e.RamStorage.prototype.hasKey = function(t) {
|
|
664
|
+
return t in this._container;
|
|
665
|
+
}, e.Library = function(t, r, a) {
|
|
666
|
+
this._startTime = /* @__PURE__ */ new Date();
|
|
667
|
+
var i = e._trimString(t);
|
|
668
|
+
if (!i)
|
|
669
|
+
throw "Missing URL!";
|
|
670
|
+
this._targetUrls = [i], this._tabName = void 0, this._pageId = void 0, this._pageViewId = "pv", this._sessionCookieName = "Rp", this._persistentCookieName = "Rz", this._isOnline = navigator && "onLine" in navigator ? navigator.onLine : !0, this._parameters = new e.ParametersContainer(), this._storage = this._getStorageProvider(), this._currentLocation = null, this._reportingInterval = e._DEFAULT_ANALYTICS_INTERVAL, this._storageKey = r || e._OFFLINE_STORAGE_KEY, this._vacuumCallback = a || function(y) {
|
|
671
|
+
return !0;
|
|
672
|
+
}, this._allowXHR = !0, this._eventQueue = [], this._requestCount = 0;
|
|
673
|
+
var o = this;
|
|
674
|
+
window.addEventListener ? (window.addEventListener("online", o._callbackBinder(this._onlineListener, o, [o]), !1), window.addEventListener("offline", o._callbackBinder(this._onlineListener, o, [o]), !1)) : document.body && (document.body.ononline = o._callbackBinder(this._onlineListener, o, [o]), document.body.onoffline = o._callbackBinder(this._onlineListener, o, [o]));
|
|
675
|
+
var c = e._getQueryParam(e._DEFAULT_ANALYTICS_COOKIE) || e._getCookie(e._DEFAULT_ANALYTICS_COOKIE) || "";
|
|
676
|
+
/^([0-9]+\|[0-9a-f-]+|amp\-[0-9a-zA-Z\_\-]+)+$/.test(c) || (c = [(/* @__PURE__ */ new Date()).getTime(), e._createUUID()].join("|"));
|
|
677
|
+
for (var u, l = (document.location.hostname || "").split("."), h = 2; h <= 3 && !u; h++) {
|
|
678
|
+
var m = l.slice(-h).join(".");
|
|
679
|
+
e._testCookieSupport(m) && (u = m);
|
|
680
|
+
}
|
|
681
|
+
if (e._setCookie(e._DEFAULT_ANALYTICS_COOKIE, c, e._DEFAULT_COOKIE_DURATION_DAYS, u), e._triggerCustomEvent("RA_PUBLISH", null), window === window.parent) {
|
|
682
|
+
"webVitals" in window && typeof window.webVitals.onFCP == "function" && typeof window.webVitals.onLCP == "function" && typeof window.webVitals.onINP == "function" && typeof window.webVitals.onCLS == "function" && typeof window.webVitals.onTTFB == "function" ? (e._WEB_VITALS = window.webVitals, e._WEB_VITALS_SCRIPT_VERSION = "*.*.*") : e._WEB_VITALS = e._loadWebVitals();
|
|
683
|
+
try {
|
|
684
|
+
e.Library.prototype.webVitals.initialize(this);
|
|
685
|
+
} catch (y) {
|
|
686
|
+
e._log(`Web-Vitals: Failed to initialize WebVitals API
|
|
687
|
+
` + y.message);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}, e.Library.prototype._getMaxQueryStringSize = function() {
|
|
691
|
+
var t = this._targetUrls.reduce(function(r, a) {
|
|
692
|
+
return Math.max(a.length, r);
|
|
693
|
+
}, 0);
|
|
694
|
+
return 2048 - (t + e._GET_RAW_REQUEST_PARAMETER.length);
|
|
695
|
+
}, e.Library.prototype.setMainReceiver = function(t) {
|
|
696
|
+
if (!(this._requestCount > 0) && e._isString(t)) {
|
|
697
|
+
t = this._normalizeScheme(t), this._targetUrls[0] = t;
|
|
698
|
+
for (var r = this._targetUrls.length - 1; r > 0; --r)
|
|
699
|
+
this._targetUrls[r] === t && this._targetUrls.splice(r, 1);
|
|
700
|
+
}
|
|
701
|
+
}, e.Library.prototype.addReceiver = function(t) {
|
|
702
|
+
if (!(this._requestCount > 0) && e._isString(t)) {
|
|
703
|
+
t = this._normalizeScheme(t);
|
|
704
|
+
for (var r = 0; r < this._targetUrls.length; ++r)
|
|
705
|
+
if (this._targetUrls[r] === t)
|
|
706
|
+
return;
|
|
707
|
+
this._targetUrls.push(t);
|
|
708
|
+
}
|
|
709
|
+
}, e.Library.prototype.setSdkSource = function(t) {
|
|
710
|
+
e._sdkSource = t;
|
|
711
|
+
}, e.Library.prototype.setSdkVersion = function(t) {
|
|
712
|
+
e._sdkVersion = t;
|
|
713
|
+
}, e.Library.prototype._normalizeScheme = function(t) {
|
|
714
|
+
var r = t.match(/^(?:https?:)?(?:\/\/)?(.*)$/);
|
|
715
|
+
return "https://" + r[1];
|
|
716
|
+
}, e.Library.prototype._callbackBinder = function(t, r, a) {
|
|
717
|
+
var i = t;
|
|
718
|
+
return function() {
|
|
719
|
+
var o = a || arguments;
|
|
720
|
+
return o = Array.prototype.slice.call(arguments[0] ? arguments : [window.event], 0), o = o.concat(a), i.apply(r || window, o);
|
|
721
|
+
};
|
|
722
|
+
}, e.Library.prototype._vacuum = function(t) {
|
|
723
|
+
if (!this._vacuumCallback || !e._isArray(t) || t.length === 0)
|
|
724
|
+
return null;
|
|
725
|
+
var r = [], a;
|
|
726
|
+
for (a = 0; a < t.length; a++) {
|
|
727
|
+
var i = t[a];
|
|
728
|
+
this._vacuumCallback(JSON.parse(i)) && r.push(i);
|
|
729
|
+
}
|
|
730
|
+
return r;
|
|
731
|
+
}, e.Library.prototype._hasLocalStorage = function() {
|
|
732
|
+
try {
|
|
733
|
+
if (!("localStorage" in window) || !window.localStorage)
|
|
734
|
+
return !1;
|
|
735
|
+
var t = "ral_localstorage_test", r = "ral_localstorage_test_item";
|
|
736
|
+
window.localStorage.setItem(t, r);
|
|
737
|
+
var a = window.localStorage.getItem(t) === r;
|
|
738
|
+
return window.localStorage.removeItem(t), a;
|
|
739
|
+
} catch {
|
|
740
|
+
return !1;
|
|
741
|
+
}
|
|
742
|
+
}, e.Library.prototype._getStorageProvider = function() {
|
|
743
|
+
return this._hasLocalStorage() ? (e._log("Using HTML Local Storage for offline data"), new e.LocalStorage()) : (e._log("Using RAM Storage for offline data. Browser does not allow usage of Local Storage."), new e.RamStorage());
|
|
744
|
+
}, e.Library.prototype._isAlphabetic = function(t) {
|
|
745
|
+
return typeof t == "string" && t !== null && /^[a-zA-Z]+$/.test(t);
|
|
746
|
+
}, e.Library.prototype._isAlphanumeric = function(t) {
|
|
747
|
+
return typeof t == "string" && t !== null && /^[0-9a-zA-Z]+$/.test(t);
|
|
748
|
+
}, e.Library.prototype._isNumeric = function(t) {
|
|
749
|
+
var r = parseInt(t, 10);
|
|
750
|
+
return !isNaN(r) && r > 0 && r == t;
|
|
751
|
+
}, e.Library.prototype._isObjectOrNull = function(t) {
|
|
752
|
+
return typeof t == "object";
|
|
753
|
+
}, e.Library.prototype.setAccountId = function(t) {
|
|
754
|
+
this._isNumeric(t) && this._parameters.insert(e.ParameterTypes.ACCOUNT_ID, t);
|
|
755
|
+
}, e.Library.prototype.setCharSet = function(t) {
|
|
756
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.CHARSET, t);
|
|
757
|
+
}, e.Library.prototype._getReferrer = function() {
|
|
758
|
+
var t = "";
|
|
759
|
+
if (document.referrer !== void 0) {
|
|
760
|
+
t = document.referrer;
|
|
761
|
+
var r = t.match(/^android-app:\/\/([^//]*)/);
|
|
762
|
+
if (r)
|
|
763
|
+
switch (r[1]) {
|
|
764
|
+
case "m.facebook.com":
|
|
765
|
+
t = "https://play.google.com/store/apps/details?id=com.facebook.katana";
|
|
766
|
+
break;
|
|
767
|
+
default:
|
|
768
|
+
t = "https://play.google.com/store/apps/details?id=" + r[1];
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return t;
|
|
772
|
+
}, e.Library.prototype._getURL = function() {
|
|
773
|
+
return document.location.href;
|
|
774
|
+
}, e.Library.prototype.setGoalId = function(t) {
|
|
775
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.GOAL_ID, t);
|
|
776
|
+
}, e.Library.prototype.setAffiliateId = function(t) {
|
|
777
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.AFFILIATE_ID, t);
|
|
778
|
+
}, e.Library.prototype._isJavaEnabled = function() {
|
|
779
|
+
if (!navigator.mimeTypes)
|
|
780
|
+
return !1;
|
|
781
|
+
var t, r = /^application\/x-java-applet;jpi-version=.*/;
|
|
782
|
+
for (t = 0; t < navigator.mimeTypes.length; t++)
|
|
783
|
+
if (r.test(navigator.mimeTypes[t].type))
|
|
784
|
+
return !0;
|
|
785
|
+
return !1;
|
|
786
|
+
}, e.Library.prototype.setServiceId = function(t) {
|
|
787
|
+
this._isNumeric(t) && this._parameters.insert(e.ParameterTypes.SERVICE_ID, t);
|
|
788
|
+
}, e.Library.prototype.setVersion = function(t) {
|
|
789
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.VERSION, t);
|
|
790
|
+
}, e.Library.prototype.setCurrencyCode = function(t) {
|
|
791
|
+
typeof t == "string" && t !== "" && t.length >= 3 && this._isAlphabetic(t) && this._parameters.insert(e.ParameterTypes.CURRENCY, t.substr(0, 3));
|
|
792
|
+
}, e.Library.prototype.setSearchQuery = function(t) {
|
|
793
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.SEARCH_QUERY, t);
|
|
794
|
+
}, e.Library.prototype.setContentLanguage = function(t) {
|
|
795
|
+
this._isObjectOrNull(t) || this._parameters.insert(
|
|
796
|
+
e.ParameterTypes.CONTENT_LANGUAGE,
|
|
797
|
+
t
|
|
798
|
+
);
|
|
799
|
+
}, e.Library.prototype.setCampaignCode = function(t) {
|
|
800
|
+
this._isAlphanumeric(t) && this._parameters.insert(e.ParameterTypes.CAMPAIGN_CODE, t);
|
|
801
|
+
}, e.Library.prototype.setCheckPoints = function(t) {
|
|
802
|
+
isNaN(parseInt(t, 10)) || this._parameters.insert(e.ParameterTypes.CHECKPOINTS, t);
|
|
803
|
+
}, e.Library.prototype.setCheckout = function(t) {
|
|
804
|
+
var r = parseInt(t, 10);
|
|
805
|
+
switch (r) {
|
|
806
|
+
case 10:
|
|
807
|
+
case 20:
|
|
808
|
+
case 30:
|
|
809
|
+
case 40:
|
|
810
|
+
case 50:
|
|
811
|
+
this._parameters.insert(e.ParameterTypes.CHECKOUT, r);
|
|
812
|
+
break;
|
|
813
|
+
default:
|
|
814
|
+
e._log("Invalid checkout " + t);
|
|
815
|
+
}
|
|
816
|
+
}, e.Library.prototype.setRequestResult = function(t) {
|
|
817
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.REQUEST_RESULT, t);
|
|
818
|
+
}, e.Library.prototype._formatTimestamp = function(t) {
|
|
819
|
+
var r = t.getMonth() + 1, a = t.getDate(), i = t.getHours(), o = t.getMinutes(), c = t.getSeconds();
|
|
820
|
+
return t.getFullYear() + "-" + (r < 10 ? "0" : "") + r + "-" + (a < 10 ? "0" : "") + a + " " + (i < 10 ? "0" : "") + i + ":" + (o < 10 ? "0" : "") + o + ":" + (c < 10 ? "0" : "") + c;
|
|
821
|
+
}, e.Library.prototype.setPageName = function(t) {
|
|
822
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.PAGE_NAME, t);
|
|
823
|
+
}, e.Library.prototype.setPageType = function(t) {
|
|
824
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.PAGE_TYPE, t);
|
|
825
|
+
}, e.Library.prototype.setGenre = function(t) {
|
|
826
|
+
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.GENRE, t);
|
|
827
|
+
}, e.Library.prototype.setCustomParameters = function(t) {
|
|
828
|
+
if (t) {
|
|
829
|
+
var r = t;
|
|
830
|
+
if (this._parameters.hasKey(e.ParameterTypes.CUSTOM)) {
|
|
831
|
+
var a = this._parameters.get(e.ParameterTypes.CUSTOM);
|
|
832
|
+
e._mergeDictionaries(a, t) && (r = a);
|
|
833
|
+
}
|
|
834
|
+
this._parameters.insert(e.ParameterTypes.CUSTOM, r);
|
|
835
|
+
}
|
|
836
|
+
}, e.Library.prototype.setViewImpressions = function(t) {
|
|
837
|
+
this._parameters.insert(e.ParameterTypes.VIEW_IMPRESSIONS, t);
|
|
838
|
+
}, e.Library.prototype.setParameters = function(t) {
|
|
839
|
+
this._parameters.setParameters(t);
|
|
840
|
+
}, e.Library.prototype.appendParameters = function(t) {
|
|
841
|
+
if (!e._isObject(t)) {
|
|
842
|
+
e._log("Invalid object type");
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
for (var r in t)
|
|
846
|
+
if (this._parameters.hasKey(r)) {
|
|
847
|
+
var a = this._parameters.get(r);
|
|
848
|
+
typeof a != "object" && (a = []), this._parameters.insert(r, [].concat(a).concat(t[r]));
|
|
849
|
+
} else
|
|
850
|
+
typeof t[r] == "object" ? this._parameters.insert(r, t[r]) : this._parameters.insert(r, [t[r]]);
|
|
851
|
+
}, e.Library.prototype.setOptions = function(t) {
|
|
852
|
+
if (e._isArray(t)) {
|
|
853
|
+
for (var r = {}, a = 0, i = t.length; a < i; ++a)
|
|
854
|
+
r[t[a]] = !0;
|
|
855
|
+
this._setAutoParameters(r);
|
|
856
|
+
}
|
|
857
|
+
}, e.Library.prototype._isRequestInternal = function() {
|
|
858
|
+
return window.navigator.userAgent !== void 0 && window.navigator.userAgent.search(/RAL/i) !== -1;
|
|
859
|
+
}, e.Library.prototype.detectFlashVersion = function() {
|
|
860
|
+
if (document.images) {
|
|
861
|
+
var t = null, r = !1, a = "application/x-shockwave-flash";
|
|
862
|
+
if (navigator.mimeTypes && navigator.mimeTypes[a]) {
|
|
863
|
+
var i = navigator.mimeTypes[a];
|
|
864
|
+
i.enabledPlugin && i.enabledPlugin.description && (t = i.enabledPlugin.description, r = !0);
|
|
865
|
+
} else if (navigator.plugins && "Shockwave Flash" in navigator.plugins) {
|
|
866
|
+
var o = navigator.plugins["Shockwave Flash"];
|
|
867
|
+
t = o.description.match(/[\d]+/g).join("."), r = !0;
|
|
868
|
+
}
|
|
869
|
+
try {
|
|
870
|
+
if (!r) {
|
|
871
|
+
var c = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
|
|
872
|
+
t = c.GetVariable("$version");
|
|
873
|
+
}
|
|
874
|
+
} catch (u) {
|
|
875
|
+
e._log("Unable to detect Adobe Flash(tm) version: " + u.toString());
|
|
876
|
+
}
|
|
877
|
+
this._parameters.insert(e.ParameterTypes.FLASH_VERSION, t);
|
|
878
|
+
}
|
|
879
|
+
}, e.Library.prototype.setCookieNames = function(t, r) {
|
|
880
|
+
e._isObject(t) ? (e.ParameterTypes.SESSION_COOKIE in t && (this._sessionCookieName = t[e.ParameterTypes.SESSION_COOKIE]), e.ParameterTypes.PERSISTENT_COOKIE in t && (this._persistentCookieName = t[e.ParameterTypes.PERSISTENT_COOKIE])) : (r && e._isString(r) && (this._sessionCookieName = r), t && e._isString(t) && (this._persistentCookieName = /** @type {string} */
|
|
881
|
+
t));
|
|
882
|
+
}, e.Library.prototype._getSessionCookie = function() {
|
|
883
|
+
return e._getCookie(this._sessionCookieName);
|
|
884
|
+
}, e.Library.prototype._getPersistentCookie = function() {
|
|
885
|
+
return e._getCookie(this._persistentCookieName);
|
|
886
|
+
}, e.Library.prototype._getBrowserLanguage = function() {
|
|
887
|
+
return navigator.browserLanguage ? navigator.browserLanguage : navigator.language ? navigator.language : e._UNKNOWN_BROWSER_LANGUAGE;
|
|
888
|
+
}, e.Library.prototype._getTimezone = function() {
|
|
889
|
+
return -(this._startTime.getTimezoneOffset() / 60);
|
|
890
|
+
}, e.Library.prototype._getUserAgent = function() {
|
|
891
|
+
return navigator.userAgent;
|
|
892
|
+
}, e.Library.prototype._getUserAgentClientHintArchitecture = function() {
|
|
893
|
+
return e._UACH[e.ParameterTypes.UACH_ARCHITECTURE];
|
|
894
|
+
}, e.Library.prototype._getUserAgentClientHintBitness = function() {
|
|
895
|
+
return e._UACH[e.ParameterTypes.UACH_BITNESS];
|
|
896
|
+
}, e.Library.prototype._getUserAgentClientHintFullVersionList = function() {
|
|
897
|
+
return e._UACH[e.ParameterTypes.UACH_FULL_VERSION_LIST];
|
|
898
|
+
}, e.Library.prototype._getUserAgentClientHintModel = function() {
|
|
899
|
+
return e._UACH[e.ParameterTypes.UACH_MODEL];
|
|
900
|
+
}, e.Library.prototype._getUserAgentClientHintPlatformVersion = function() {
|
|
901
|
+
return e._UACH[e.ParameterTypes.UACH_PLATFORM_VERSION];
|
|
902
|
+
}, e.Library.prototype._getUserAgentClientHintWow64 = function() {
|
|
903
|
+
return e._UACH[e.ParameterTypes.UACH_WOW64];
|
|
904
|
+
}, e.Library.prototype._getScreenResolution = function() {
|
|
905
|
+
return window.screen.width + "x" + window.screen.height;
|
|
906
|
+
}, e.Library.prototype._getTabName = function() {
|
|
907
|
+
var t;
|
|
908
|
+
if (this._tabName ? t = this._tabName : window.sessionStorage && (t = window.sessionStorage.getItem(e._KEY_PREFIX_MARKER + e._TAB_ID_KEY)), !t) {
|
|
909
|
+
var r = Math.floor(Math.random() * 65536);
|
|
910
|
+
if (t = r.toString(16) + (r * 17 & 65535).toString(16), window.sessionStorage)
|
|
911
|
+
try {
|
|
912
|
+
window.sessionStorage.setItem(e._KEY_PREFIX_MARKER + e._TAB_ID_KEY, t);
|
|
913
|
+
} catch (a) {
|
|
914
|
+
e._log("Could not write to session storage: " + a.toString()), this._tabName = t;
|
|
915
|
+
}
|
|
916
|
+
else
|
|
917
|
+
this._tabName = t;
|
|
918
|
+
}
|
|
919
|
+
return t;
|
|
920
|
+
}, e.Library.prototype._getPageId = function() {
|
|
921
|
+
var t = this._pageId;
|
|
922
|
+
if (!t) {
|
|
923
|
+
var r = e._hash(document.location.href, !0), a = e._hash(document.referrer, !0), i = e._hash(navigator.userAgent, !0), o = e._hash((/* @__PURE__ */ new Date()).getTime().toString(), !0);
|
|
924
|
+
t = r + a + i + o, this._pageId = t;
|
|
925
|
+
}
|
|
926
|
+
return t;
|
|
927
|
+
}, e.Library.prototype.resetPageId = function() {
|
|
928
|
+
this._pageId = void 0;
|
|
929
|
+
}, e.Library.prototype._getRequestTiming = function(t) {
|
|
930
|
+
if (t.navigationStart > 0 && t.domLoading > 0) {
|
|
931
|
+
if (t.domLoading < t.navigationStart)
|
|
932
|
+
throw "UnexpectedTimingException";
|
|
933
|
+
return t.domLoading - t.navigationStart;
|
|
934
|
+
}
|
|
935
|
+
}, e.Library.prototype._getPageInitLoadTiming = function(t) {
|
|
936
|
+
if (t.domLoading > 0 && t.domContentLoadedEventStart > 0) {
|
|
937
|
+
if (t.domContentLoadedEventStart < t.domLoading)
|
|
938
|
+
throw "UnexpectedTimingException";
|
|
939
|
+
return t.domContentLoadedEventStart - t.domLoading;
|
|
940
|
+
}
|
|
941
|
+
}, e.Library.prototype._getTotalPageLoadTime = function(t, r) {
|
|
942
|
+
if (r) {
|
|
943
|
+
if ("duration" in t)
|
|
944
|
+
return Math.round(t.duration);
|
|
945
|
+
throw "UnexpectedTimingException";
|
|
946
|
+
} else if (t.loadEventEnd > 0 && t.navigationStart > 0) {
|
|
947
|
+
if (t.loadEventEnd < t.navigationStart)
|
|
948
|
+
throw "UnexpectedTimingException";
|
|
949
|
+
return t.loadEventEnd - t.navigationStart;
|
|
950
|
+
}
|
|
951
|
+
}, e.Library.prototype._getPageAsyncLoadTiming = function(t) {
|
|
952
|
+
if (t.domContentLoadedEventStart > 0 && t.domComplete > 0) {
|
|
953
|
+
if (t.domComplete < t.domContentLoadedEventStart)
|
|
954
|
+
throw "UnexpectedTimingException";
|
|
955
|
+
return t.domComplete - t.domContentLoadedEventStart;
|
|
956
|
+
}
|
|
957
|
+
}, e.Library.prototype._getBrowserTimings = function() {
|
|
958
|
+
if ("performance" in window) {
|
|
959
|
+
var t, r, a = !1;
|
|
960
|
+
if (window.performance.getEntriesByType("navigation")) {
|
|
961
|
+
var i = window.performance.getEntriesByType("navigation").length;
|
|
962
|
+
t = window.performance.getEntriesByType("navigation")[i - 1], a = !0;
|
|
963
|
+
}
|
|
964
|
+
if (window.performance.timing && (r = window.performance.timing), !(window.performance.timing || window.performance.getEntriesByType("navigation")))
|
|
965
|
+
return;
|
|
966
|
+
var o = {}, c = !1;
|
|
967
|
+
try {
|
|
968
|
+
o[e.ParameterTypes.REQUEST_TIMING] = this._getRequestTiming(r);
|
|
969
|
+
} catch {
|
|
970
|
+
c = !0;
|
|
971
|
+
}
|
|
972
|
+
try {
|
|
973
|
+
o[e.ParameterTypes.LOAD_TIMING] = this._getPageInitLoadTiming(r);
|
|
974
|
+
} catch {
|
|
975
|
+
c = !0;
|
|
976
|
+
}
|
|
977
|
+
try {
|
|
978
|
+
o[e.ParameterTypes.TOTAL_PAGE_LOAD_TIME] = a ? this._getTotalPageLoadTime(t, a) : this._getTotalPageLoadTime(r, a);
|
|
979
|
+
} catch {
|
|
980
|
+
c = !0;
|
|
981
|
+
}
|
|
982
|
+
try {
|
|
983
|
+
o[e.ParameterTypes.ASYNC_TIMING] = this._getPageAsyncLoadTiming(r);
|
|
984
|
+
} catch {
|
|
985
|
+
c = !0;
|
|
986
|
+
}
|
|
987
|
+
return c && (o[e.ParameterTypes.DEBUG] = {}, o[e.ParameterTypes.DEBUG].nav_timing = t), o;
|
|
988
|
+
}
|
|
989
|
+
}, e.Library.prototype._getNavigationType = function() {
|
|
990
|
+
if ("performance" in window && window.performance.navigation)
|
|
991
|
+
return window.performance.navigation.type;
|
|
992
|
+
}, e.Library.prototype._isFrame = function() {
|
|
993
|
+
return window === window.parent || window.isAmp ? 0 : 1;
|
|
994
|
+
}, e.Library.prototype._getPageLayout = function() {
|
|
995
|
+
if (window.sc_layout)
|
|
996
|
+
return window.sc_layout;
|
|
997
|
+
var t = document.getElementsByName("geLayout");
|
|
998
|
+
return t.length > 0 ? t[0].value : document.getElementsByName("viewport").length > 0 ? "SP" : "PC";
|
|
999
|
+
}, e.Library.prototype.setEvent = function(t, r) {
|
|
1000
|
+
e._isString(t) && (this._parameters.insert(e.ParameterTypes.EVENT_TYPE, t), t in e._EVENT_MERGE_FLAGS && typeof r == "boolean" && (e._EVENT_MERGE_FLAGS[t] = r), t == this._pageViewId ? this.pageViewEvent() : this._queueEvent());
|
|
1001
|
+
}, e.Library.prototype.setXHRAllowed = function(t) {
|
|
1002
|
+
this._allowXHR = !!t;
|
|
1003
|
+
}, e.Library.prototype.pageViewEvent = function() {
|
|
1004
|
+
if (this._isRequestInternal()) {
|
|
1005
|
+
e._log("Internal request");
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
if (!this._parameters.hasKey(e.ParameterTypes.ACCOUNT_ID) && !this._hasOfflineEvents()) {
|
|
1009
|
+
e._log("No data collected");
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
this._setAutoParameters(), this._queueEvent();
|
|
1013
|
+
}, e.Library.prototype.removeEventLogs = function() {
|
|
1014
|
+
e.eventLog = [];
|
|
1015
|
+
}, e.Library.prototype._getFingerPrint = function() {
|
|
1016
|
+
var t, r = e._KEY_PREFIX_MARKER + e._FPRINT_KEY;
|
|
1017
|
+
if (window.sessionStorage && (t = window.sessionStorage.getItem(r), !t)) {
|
|
1018
|
+
var a = document.createElement("script");
|
|
1019
|
+
a.type = "text/javascript", a.src = "//a.ichiba.jp.rakuten-static.com/com/rat/js/common/fingerprint2.min.js", a.onload = function() {
|
|
1020
|
+
try {
|
|
1021
|
+
new Fingerprint2().get(function(o) {
|
|
1022
|
+
try {
|
|
1023
|
+
window.sessionStorage.setItem(r, o);
|
|
1024
|
+
} catch (c) {
|
|
1025
|
+
e._log("Cannot store fingerprint in session: " + c.toString());
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
} catch (o) {
|
|
1029
|
+
e._log("Error initializing fingerprint: " + o.toString());
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
var i = document.getElementsByTagName("script")[0];
|
|
1033
|
+
i.parentNode.insertBefore(a, i);
|
|
1034
|
+
}
|
|
1035
|
+
return t;
|
|
1036
|
+
}, e.Library.prototype.webVitals = {
|
|
1037
|
+
_initialized: !1,
|
|
1038
|
+
_cache: {},
|
|
1039
|
+
_isSendPerf: !1,
|
|
1040
|
+
_sentMetrics: [],
|
|
1041
|
+
sendPerfListener: function(t, r, a) {
|
|
1042
|
+
var i = this;
|
|
1043
|
+
i._isSendPerf && i.sendWebVitalsPerf(t, r, a);
|
|
1044
|
+
},
|
|
1045
|
+
initialize: function(t) {
|
|
1046
|
+
if (!(!e._WEB_VITALS || this._initialized) && "sendBeacon" in window.navigator) {
|
|
1047
|
+
var r = new e.SendBeaconTransport(t._targetUrls), a = t._getBrowserTimings.bind(t), i = t._parameters, o = this, c = o._cache, u = document.getElementById("ratAccountId"), l = document.getElementById("ratServiceId");
|
|
1048
|
+
this._isSendPerf = Math.random() < e._WEB_VITALS_SAMPLING_RATIO, u ? c.acc = u.getAttribute("value") : e._log("webVitals.initialize: ratAccountId input tag not found"), l && (c.aid = l.getAttribute("value")), c.SCRIPT_VER = e._WEB_VITALS_SCRIPT_VERSION, c.UID = e._createUUID(), Object.defineProperties(o, {
|
|
1049
|
+
FCP: {
|
|
1050
|
+
get: function() {
|
|
1051
|
+
return c.FCP;
|
|
1052
|
+
},
|
|
1053
|
+
set: function(p) {
|
|
1054
|
+
c.FCP = p;
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
LCP: {
|
|
1058
|
+
get: function() {
|
|
1059
|
+
return c.LCP;
|
|
1060
|
+
},
|
|
1061
|
+
set: function(p) {
|
|
1062
|
+
c.LCP = p;
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
CLS: {
|
|
1066
|
+
get: function() {
|
|
1067
|
+
return c.CLS;
|
|
1068
|
+
},
|
|
1069
|
+
set: function(p) {
|
|
1070
|
+
c.CLS = p;
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
TTFB: {
|
|
1074
|
+
get: function() {
|
|
1075
|
+
return c.TTFB;
|
|
1076
|
+
},
|
|
1077
|
+
set: function(p) {
|
|
1078
|
+
c.TTFB = p;
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
INP: {
|
|
1082
|
+
get: function() {
|
|
1083
|
+
return c.INP;
|
|
1084
|
+
},
|
|
1085
|
+
set: function(p) {
|
|
1086
|
+
c.INP = p;
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
UID: {
|
|
1090
|
+
get: function() {
|
|
1091
|
+
return c.UID;
|
|
1092
|
+
},
|
|
1093
|
+
set: function(p) {
|
|
1094
|
+
c.UID = p;
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
SCRIPT_VER: {
|
|
1098
|
+
get: function() {
|
|
1099
|
+
return c.SCRIPT_VER;
|
|
1100
|
+
},
|
|
1101
|
+
set: function(p) {
|
|
1102
|
+
c.SCRIPT_VER = p;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
});
|
|
1106
|
+
var h = e._WEB_VITALS.onFCP;
|
|
1107
|
+
h(function(p) {
|
|
1108
|
+
o._cache.FCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
|
|
1109
|
+
});
|
|
1110
|
+
var m = e._WEB_VITALS.onLCP;
|
|
1111
|
+
m(function(p) {
|
|
1112
|
+
o._cache.LCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
|
|
1113
|
+
});
|
|
1114
|
+
var y = e._WEB_VITALS.onCLS;
|
|
1115
|
+
y(function(p) {
|
|
1116
|
+
o._cache.CLS = p.value.toFixed(3), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
|
|
1117
|
+
});
|
|
1118
|
+
var f = e._WEB_VITALS.onTTFB;
|
|
1119
|
+
f(function(p) {
|
|
1120
|
+
o._cache.TTFB = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
|
|
1121
|
+
});
|
|
1122
|
+
var I = e._WEB_VITALS.onINP;
|
|
1123
|
+
I(function(p) {
|
|
1124
|
+
o._cache.INP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, a, r);
|
|
1125
|
+
}), o._initialized = !0;
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
/**
|
|
1129
|
+
* Set all Web Vitals Metrics automatically
|
|
1130
|
+
* Can take an optional configuration object to set only the metrics specified
|
|
1131
|
+
*
|
|
1132
|
+
* @param {Object} parameters parameters from RAL.Library
|
|
1133
|
+
* @param {Function} getBrowserTimings bound function for getting timings
|
|
1134
|
+
* @param {Object} transport used to send events (SendBeaconTransport instance)
|
|
1135
|
+
* @private
|
|
1136
|
+
*/
|
|
1137
|
+
sendWebVitalsPerf: function(t, r, a) {
|
|
1138
|
+
var i = this.needsToSendMetric(this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP) && this.needsToSendMetric(this._cache.LCP, e.ParameterTypes.WEB_VITALS_LCP) && this.needsToSendMetric(this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB), o = this.needsToSendMetric(this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS) || this.needsToSendMetric(this._cache.INP, e.ParameterTypes.WEB_VITALS_INP);
|
|
1139
|
+
if (!(!i && !o) && this._cache.acc && (this._cache.acc = parseInt(this._cache.acc, 10), !isNaN(parseInt(this._cache.acc, 10)))) {
|
|
1140
|
+
this._cache.aid || (this._cache.aid = e._DEFAULT_SERVICE_ID), e.callQueue = e.callQueue || [];
|
|
1141
|
+
var c = this.buildPerfData(t, r());
|
|
1142
|
+
a.send(JSON.stringify(c)), [
|
|
1143
|
+
e.ParameterTypes.WEB_VITALS_FCP,
|
|
1144
|
+
e.ParameterTypes.WEB_VITALS_LCP,
|
|
1145
|
+
e.ParameterTypes.WEB_VITALS_CLS,
|
|
1146
|
+
e.ParameterTypes.WEB_VITALS_INP,
|
|
1147
|
+
e.ParameterTypes.WEB_VITALS_TTFB
|
|
1148
|
+
].forEach(function(u) {
|
|
1149
|
+
c.hasOwnProperty(u) && this._sentMetrics.push(u);
|
|
1150
|
+
}, this);
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
/**
|
|
1154
|
+
* Builds the data object which will be sent as the payload for the perf event.
|
|
1155
|
+
*
|
|
1156
|
+
* @param {Object} parameters Parameters where data will be picked from
|
|
1157
|
+
* @param {Object} timings Browser timing data which will be attached to the event
|
|
1158
|
+
* @private
|
|
1159
|
+
*/
|
|
1160
|
+
buildPerfData: function(t, r) {
|
|
1161
|
+
var a = {};
|
|
1162
|
+
return [
|
|
1163
|
+
e.ParameterTypes.URL,
|
|
1164
|
+
e.ParameterTypes.USER_AGENT,
|
|
1165
|
+
e.ParameterTypes.ACCOUNT_ID,
|
|
1166
|
+
e.ParameterTypes.SERVICE_ID,
|
|
1167
|
+
e.ParameterTypes.PAGE_ID,
|
|
1168
|
+
e.ParameterTypes.UACH_ARCHITECTURE,
|
|
1169
|
+
e.ParameterTypes.UACH_BITNESS,
|
|
1170
|
+
e.ParameterTypes.UACH_FULL_VERSION_LIST,
|
|
1171
|
+
e.ParameterTypes.UACH_PLATFORM_VERSION,
|
|
1172
|
+
e.ParameterTypes.UACH_WOW64,
|
|
1173
|
+
e.ParameterTypes.ANALYTICS_COOKIE,
|
|
1174
|
+
e.ParameterTypes.SESSION_COOKIE_FLAG,
|
|
1175
|
+
e.ParameterTypes.SESSION_COOKIE_2
|
|
1176
|
+
].forEach(function(i) {
|
|
1177
|
+
t.hasKey(i) && (a[i] = t.get(i));
|
|
1178
|
+
}), [
|
|
1179
|
+
[this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP],
|
|
1180
|
+
[this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS],
|
|
1181
|
+
[this._cache.LCP, e.ParameterTypes.WEB_VITALS_LCP],
|
|
1182
|
+
[this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB],
|
|
1183
|
+
[this._cache.INP, e.ParameterTypes.WEB_VITALS_INP]
|
|
1184
|
+
].forEach(function(i) {
|
|
1185
|
+
this.needsToSendMetric(i[0], i[1]) && (a[i[1]] = i[0]);
|
|
1186
|
+
}, this), a[e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION] = e._WEB_VITALS_SCRIPT_VERSION, a[e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER] = this._cache.UID, [
|
|
1187
|
+
e.ParameterTypes.TOTAL_PAGE_LOAD_TIME,
|
|
1188
|
+
e.ParameterTypes.ASYNC_TIMING,
|
|
1189
|
+
e.ParameterTypes.LOAD_TIMING,
|
|
1190
|
+
e.ParameterTypes.REQUEST_TIMING
|
|
1191
|
+
].forEach(function(i) {
|
|
1192
|
+
r.hasOwnProperty(i) && (a[i] = r[i]);
|
|
1193
|
+
}), a[e.ParameterTypes.EVENT_TYPE] = "perf", a;
|
|
1194
|
+
},
|
|
1195
|
+
/**
|
|
1196
|
+
* Checks whether metric needs to be sent.
|
|
1197
|
+
* Needs to be sent if the metric has a value in the cache, but does not have a value in _sentMetrics.
|
|
1198
|
+
*
|
|
1199
|
+
* @param {String} cachedMetric Metric value from cache
|
|
1200
|
+
* @param {String} parameterType Parameter name for the metric from RAL.ParameterTypes
|
|
1201
|
+
* @private
|
|
1202
|
+
*/
|
|
1203
|
+
needsToSendMetric: function(t, r) {
|
|
1204
|
+
var a = t !== void 0, i = this._sentMetrics.indexOf(r) === -1;
|
|
1205
|
+
return a && i;
|
|
1206
|
+
}
|
|
1207
|
+
}, e.Library.prototype._setAutoParameters = function(t) {
|
|
1208
|
+
(!t || t[e.ParameterTypes.SCRIPT_START_TIME]) && this._parameters.insert(e.ParameterTypes.SCRIPT_START_TIME, this._formatTimestamp(this._startTime)), (!t || t[e.ParameterTypes.URL]) && (this._parameters.hasKey(e.ParameterTypes.URL) || this._parameters.insert(e.ParameterTypes.URL, this._getURL())), (!t || t[e.ParameterTypes.REFERRER]) && (this._parameters.hasKey(e.ParameterTypes.REFERRER) || this._parameters.insert(e.ParameterTypes.REFERRER, this._getReferrer())), (!t || t[e.ParameterTypes.TAB_ID]) && this._parameters.insert(e.ParameterTypes.TAB_ID, this._getTabName()), (!t || t[e.ParameterTypes.TIMEZONE]) && this._parameters.insert(e.ParameterTypes.TIMEZONE, this._getTimezone()), (!t || t[e.ParameterTypes.RESOLUTION]) && this._parameters.insert(e.ParameterTypes.RESOLUTION, this._getScreenResolution()), (!t || t[e.ParameterTypes.JAVA_PRESENT]) && this._parameters.insert(e.ParameterTypes.JAVA_PRESENT, this._isJavaEnabled()), (!t || t[e.ParameterTypes.BROWSER_LANGUAGE]) && this._parameters.insert(e.ParameterTypes.BROWSER_LANGUAGE, this._getBrowserLanguage()), (!t || t[e.ParameterTypes.USER_AGENT]) && (this._parameters.hasKey(e.ParameterTypes.USER_AGENT) || this._parameters.insert(e.ParameterTypes.USER_AGENT, this._getUserAgent())), (!t || t[e.ParameterTypes.ONLINE_STATUS]) && this._parameters.insert(e.ParameterTypes.ONLINE_STATUS, this._isOnline), (!t || t[e.ParameterTypes.VERSION]) && this._parameters.insert(e.ParameterTypes.VERSION, e._sdkVersion), (!t || t[e.ParameterTypes.SDK_SOURCE]) && this._parameters.insert(e.ParameterTypes.SDK_SOURCE, e._sdkSource), (!t || t[e.ParameterTypes.LOCATION]) && (this._currentLocation === null ? this._parameters.remove(e.ParameterTypes.LOCATION) : this._parameters.insert(e.ParameterTypes.LOCATION, this._currentLocation)), (!t || t.perf) && this._parameters.mergeParameters(this._getBrowserTimings()), (!t || t[e.ParameterTypes.NAV_TYPE]) && this._parameters.insert(e.ParameterTypes.NAV_TYPE, this._getNavigationType()), (!t || t[e.ParameterTypes.IFRAME_STATUS]) && this._parameters.insert(e.ParameterTypes.IFRAME_STATUS, this._isFrame()), (!t || t[e.ParameterTypes.UACH_ARCHITECTURE]) && (this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture())), (!t || t[e.ParameterTypes.UACH_BITNESS]) && (this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness())), (!t || t[e.ParameterTypes.UACH_FULL_VERSION_LIST]) && (this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList())), (!t || t[e.ParameterTypes.UACH_MODEL]) && (this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel())), (!t || t[e.ParameterTypes.UACH_PLATFORM_VERSION]) && (this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion())), (!t || t[e.ParameterTypes.UACH_WOW64]) && (this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64())), t && t[e.ParameterTypes.WEB_VITALS_LCP] && this._parameters.insert(
|
|
1209
|
+
e.ParameterTypes.WEB_VITALS_LCP,
|
|
1210
|
+
this.webVitals.LCP
|
|
1211
|
+
), t && t[e.ParameterTypes.WEB_VITALS_FCP] && this._parameters.insert(
|
|
1212
|
+
e.ParameterTypes.WEB_VITALS_FCP,
|
|
1213
|
+
this.webVitals.FCP
|
|
1214
|
+
), t && t[e.ParameterTypes.WEB_VITALS_CLS] && this._parameters.insert(
|
|
1215
|
+
e.ParameterTypes.WEB_VITALS_CLS,
|
|
1216
|
+
this.webVitals.CLS
|
|
1217
|
+
), t && t[e.ParameterTypes.WEB_VITALS_TTFB] && this._parameters.insert(
|
|
1218
|
+
e.ParameterTypes.WEB_VITALS_TTFB,
|
|
1219
|
+
this.webVitals.TTFB
|
|
1220
|
+
), t && t[e.ParameterTypes.WEB_VITALS_INP] && this._parameters.insert(
|
|
1221
|
+
e.ParameterTypes.WEB_VITALS_INP,
|
|
1222
|
+
this.webVitals.INP
|
|
1223
|
+
), t && t[e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER] && this._parameters.insert(
|
|
1224
|
+
e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER,
|
|
1225
|
+
this.webVitals.UID
|
|
1226
|
+
), t && t[e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION] && this._parameters.insert(
|
|
1227
|
+
e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION,
|
|
1228
|
+
this.webVitals.SCRIPT_VER
|
|
1229
|
+
);
|
|
1230
|
+
}, e.Library.prototype._needsBulkUpload = function() {
|
|
1231
|
+
var t = this._getOfflineEvents();
|
|
1232
|
+
return t.length === 0 ? (e._log("No records to upload"), !1) : t.length > 1 ? !0 : encodeURIComponent(t[0]).length < this._getMaxQueryStringSize();
|
|
1233
|
+
}, e.Library.prototype._sendSingleRecord = function(t) {
|
|
1234
|
+
try {
|
|
1235
|
+
e._activeTransport.send(t, "GET");
|
|
1236
|
+
} catch (r) {
|
|
1237
|
+
return e._log("Single item upload failed: " + r.toString()), !1;
|
|
1238
|
+
}
|
|
1239
|
+
return !0;
|
|
1240
|
+
}, e.Library.prototype._sendSingleRecordImg = function(t) {
|
|
1241
|
+
e._log("Using img transport");
|
|
1242
|
+
try {
|
|
1243
|
+
for (var r = 0; r < this._targetUrls.length; ++r) {
|
|
1244
|
+
var a = document.createElement("img");
|
|
1245
|
+
a.src = this._targetUrls[r] + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t) + "&t=" + (/* @__PURE__ */ new Date()).getTime();
|
|
1246
|
+
}
|
|
1247
|
+
} catch (i) {
|
|
1248
|
+
return e._log("Single item upload failed: " + i.toString()), !1;
|
|
1249
|
+
}
|
|
1250
|
+
return !0;
|
|
1251
|
+
}, e.Library.prototype._sendMultipleRecords = function(t) {
|
|
1252
|
+
try {
|
|
1253
|
+
if (t.length === 0)
|
|
1254
|
+
return !0;
|
|
1255
|
+
var r = t.length === 1 ? t[0] : "[" + t.join(",") + "]";
|
|
1256
|
+
e._activeTransport.send(r, "POST");
|
|
1257
|
+
} catch (a) {
|
|
1258
|
+
return e._log("Bulk upload failed: " + a.toString()), !1;
|
|
1259
|
+
}
|
|
1260
|
+
return !0;
|
|
1261
|
+
}, e.Library.prototype._sendRecords = function(t) {
|
|
1262
|
+
if (t === null || typeof t != "object" || t.length === 0)
|
|
1263
|
+
return !0;
|
|
1264
|
+
var r = !0;
|
|
1265
|
+
return t.length === 1 ? encodeURIComponent(t[0]).length < this._getMaxQueryStringSize() ? r = !this._allowXHR && e._transportMethod !== "beacon" ? this._sendSingleRecordImg(t[0]) : this._sendSingleRecord(t[0]) : (e._log("Record too big to send via GET (" + encodeURIComponent(t[0]).length + " characters vs. " + this._getMaxQueryStringSize() + " characters max)"), r = this._sendMultipleRecords(t)) : (this._allowXHR || e._transportMethod === "beacon" ? r = this._sendMultipleRecords(t) : r = !1, r && e._log("All items successfully sent")), r;
|
|
1266
|
+
}, e.Library.prototype._spoolData = function(t, r) {
|
|
1267
|
+
var a = null;
|
|
1268
|
+
if (t.hasKey(e.ParameterTypes.ACCOUNT_ID)) {
|
|
1269
|
+
var i;
|
|
1270
|
+
if (/\bsplash\b/i.test(navigator.userAgent) ? i = "splash_agent" : i = this._getSessionCookie(), t.insert(e.ParameterTypes.SESSION_COOKIE, i), /\bra_uid\b/.test(document.cookie)) {
|
|
1271
|
+
var o = e._getCookie("ra_uid");
|
|
1272
|
+
if (o) {
|
|
1273
|
+
o = decodeURIComponent(o);
|
|
1274
|
+
var c = o.match(/^"(.*)"$/);
|
|
1275
|
+
c && (o = c[1]);
|
|
1276
|
+
var u = e._getCookie("rat_uid", o);
|
|
1277
|
+
u && t.insert(e.ParameterTypes.SESSION_COOKIE, u);
|
|
1278
|
+
var l = e._getCookie("a_uid", o);
|
|
1279
|
+
l && t.insert(e.ParameterTypes.AD_COOKIE, l);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
var h = e._getCookie(e._DEFAULT_ANALYTICS_COOKIE);
|
|
1283
|
+
t.insert(e.ParameterTypes.ANALYTICS_COOKIE, h), t.hasKey(e.ParameterTypes.SESSION_COOKIE) ? (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !0), t.insert(e.ParameterTypes.SESSION_COOKIE_2, t.get(e.ParameterTypes.SESSION_COOKIE))) : (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !1), t.insert(e.ParameterTypes.SESSION_COOKIE_2, h)), t.insert(e.ParameterTypes.PERSISTENT_COOKIE, this._getPersistentCookie()), this._setCookies(t, ["Rg", "Rt", "BTA001"]), a = t.serialize();
|
|
1284
|
+
var m = this._getOfflineEvents();
|
|
1285
|
+
m.length >= e._RECORDS_LIMIT_COUNT && (e._log("Too many records, vacuuming"), m = this._vacuum(m) || m), a.length + m.join().length > e._RECORDS_LIMIT_TOTAL_SIZE && (e._log("Data block too large, vacuuming"), m = this._vacuum(m) || m);
|
|
1286
|
+
var y = this._addOfflineEvent(a);
|
|
1287
|
+
if (y) {
|
|
1288
|
+
if (a = null, r)
|
|
1289
|
+
return;
|
|
1290
|
+
} else
|
|
1291
|
+
e._log("Unable to save data to offline storage");
|
|
1292
|
+
}
|
|
1293
|
+
if (this._isOnline) {
|
|
1294
|
+
var f = this._getOfflineEvents();
|
|
1295
|
+
a && f.push(a);
|
|
1296
|
+
var I = Math.min(f.length, e._RECORDS_CHUNK_LENGTH);
|
|
1297
|
+
I != f.length ? e._log("Too many records to send in one single operation (" + f.length + " vs " + e._RECORDS_CHUNK_LENGTH + " maximum)") : e._log("Record count threshold not crossed, sending all records in one go");
|
|
1298
|
+
var p = f.splice(0, I), ie = this._sendRecords(p);
|
|
1299
|
+
if (ie) {
|
|
1300
|
+
this._requestCount++;
|
|
1301
|
+
for (var U = 0; U < p.length; ++U)
|
|
1302
|
+
try {
|
|
1303
|
+
e.eventLog.push(JSON.parse(p[U]));
|
|
1304
|
+
} catch (oe) {
|
|
1305
|
+
e._log("Error while writing to event log: " + oe.toString());
|
|
1306
|
+
}
|
|
1307
|
+
e._triggerCustomEvent("RAT_REQUEST_DONE", null), this._setOfflineEvents(f) ? e._log("Old data successfully removed") : e._log("Unable to save data to offline storage");
|
|
1308
|
+
} else
|
|
1309
|
+
e._log("Data transfer failed!");
|
|
1310
|
+
}
|
|
1311
|
+
}, e.Library.prototype._setCookies = function(t, r) {
|
|
1312
|
+
if (e._isArray(r))
|
|
1313
|
+
for (var a, i, o = 0; o < r.length; o++)
|
|
1314
|
+
a = r[o], i = e._getCookie(a), i !== null && t.insert(a, decodeURIComponent(i));
|
|
1315
|
+
}, e.Library.prototype._onlineListener = function(t) {
|
|
1316
|
+
t = t || window.event, this._isOnline = t.type === "online", e._log("Online status change: " + (this._isOnline ? "Online" : "Offline"));
|
|
1317
|
+
}, e.Library.prototype._hasOfflineEvents = function() {
|
|
1318
|
+
return this._storage.hasKey(this._storageKey);
|
|
1319
|
+
}, e.Library.prototype._clearOfflineEvents = function() {
|
|
1320
|
+
this._storage.removeKey(this._storageKey);
|
|
1321
|
+
}, e.Library.prototype._getOfflineEvents = function() {
|
|
1322
|
+
var t;
|
|
1323
|
+
if (this._storage.hasKey(this._storageKey)) {
|
|
1324
|
+
var r = this._storage.getForKey(this._storageKey);
|
|
1325
|
+
t = r.split(" ");
|
|
1326
|
+
} else
|
|
1327
|
+
t = [];
|
|
1328
|
+
return t;
|
|
1329
|
+
}, e.Library.prototype._setOfflineEvents = function(t) {
|
|
1330
|
+
var r = !1;
|
|
1331
|
+
return t && t instanceof Array && (t.length === 0 ? (this._storage.removeKey(this._storageKey), r = !0) : r = this._storage.setForKey(this._storageKey, t.join(" "))), r;
|
|
1332
|
+
}, e.Library.prototype._addOfflineEvent = function(t) {
|
|
1333
|
+
var r = !1;
|
|
1334
|
+
if (t) {
|
|
1335
|
+
var a = this._getOfflineEvents();
|
|
1336
|
+
a.push(t), r = this._storage.setForKey(this._storageKey, a.join(" "));
|
|
1337
|
+
}
|
|
1338
|
+
return r;
|
|
1339
|
+
}, e.Library.prototype._setPosition = function(t) {
|
|
1340
|
+
this._currentLocation = {}, this._currentLocation[e.ParameterTypes.LATITUDE] = t.coords.latitude, this._currentLocation[e.ParameterTypes.LONGITUDE] = t.coords.longitude, this._currentLocation[e.ParameterTypes.ACCURACY] = t.coords.accuracy, t.coords.speed && (this._currentLocation[e.ParameterTypes.SPEED] = t.coords.speed), t.coords.altitude && (this._currentLocation[e.ParameterTypes.ALTITUDE] = t.coords.altitude), t.coords.heading && (this._currentLocation[e.ParameterTypes.HEADING] = t.coords.heading), t.coords.altitudeAccuracy && (this._currentLocation[e.ParameterTypes.ALTITUDE_ACCURACY] = t.coords.altitudeAccuracy), this._currentLocation[e.ParameterTypes.GPS_TIMESTAMP] = t.timestamp;
|
|
1341
|
+
}, e.Library.prototype._onPositionError = function(t) {
|
|
1342
|
+
switch (t.code) {
|
|
1343
|
+
case t.PERMISSION_DENIED: {
|
|
1344
|
+
e._log("Permission denied when retrieving GPS fix: " + t.message);
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
case t.POSITION_UNAVAILABLE: {
|
|
1348
|
+
e._log("Unable to get a valid GPS fix: " + t.message);
|
|
1349
|
+
break;
|
|
1350
|
+
}
|
|
1351
|
+
case t.TIMEOUT: {
|
|
1352
|
+
e._log("Timeout when getting a GPS fix: " + t.message);
|
|
1353
|
+
break;
|
|
1354
|
+
}
|
|
1355
|
+
default:
|
|
1356
|
+
e._log("Unknown error code " + t.code + ": " + t.message);
|
|
1357
|
+
}
|
|
1358
|
+
}, e.Library.prototype.getLocation = function() {
|
|
1359
|
+
navigator.geolocation ? (this._currentLocation = null, navigator.geolocation.getCurrentPosition(
|
|
1360
|
+
this._callbackBinder(this._setPosition, this, [this]),
|
|
1361
|
+
this._onPositionError
|
|
1362
|
+
)) : e._log("GPS GeoLocation is not available!");
|
|
1363
|
+
}, e.Library.prototype.setReportingInterval = function(t) {
|
|
1364
|
+
var r = parseInt(t, 10);
|
|
1365
|
+
!isNaN(r) && r > 0 ? this._reportingInterval = r : e._log("Invalid interval " + t);
|
|
1366
|
+
}, e.Library.prototype._queueEvent = function() {
|
|
1367
|
+
this._parameters.hasKey(e.ParameterTypes.ACCOUNT_ID) && (this._parameters.insert(e.ParameterTypes.PAGE_ID, this._getPageId()), (!this._parameters.hasKey(e.ParameterTypes.SERVICE_ID) || this._parameters.get(e.ParameterTypes.SERVICE_ID) == null) && this._parameters.insert(e.ParameterTypes.SERVICE_ID, e._DEFAULT_SERVICE_ID), this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture()), this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness()), this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList()), this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel()), this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion()), this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64()), this._eventQueue.push(this._parameters), this._parameters = new e.ParametersContainer());
|
|
1368
|
+
}, e.Library.prototype._normalizeEvents = function() {
|
|
1369
|
+
this._queueEvent();
|
|
1370
|
+
for (var t = 0, r = 1, a, i; r < this._eventQueue.length; )
|
|
1371
|
+
a = this._eventQueue[t], i = this._eventQueue[r], a.get(e.ParameterTypes.ACCOUNT_ID) === i.get(e.ParameterTypes.ACCOUNT_ID) && a.get(e.ParameterTypes.SERVICE_ID) === i.get(e.ParameterTypes.SERVICE_ID) && a.get(e.ParameterTypes.EVENT_TYPE) === i.get(e.ParameterTypes.EVENT_TYPE) && a.shouldMergeSeries() ? (a.mergeParameters(i.clone()), this._eventQueue.splice(r, 1)) : (t++, r++);
|
|
1372
|
+
}, e.Library.prototype.processQueue = function(t) {
|
|
1373
|
+
var r = this;
|
|
1374
|
+
if (!e._isArray(e.callQueue))
|
|
1375
|
+
e._log("No call queue to process");
|
|
1376
|
+
else {
|
|
1377
|
+
e.callQueue.length && e._log(e.callQueue.length + " elements to process in the queue");
|
|
1378
|
+
try {
|
|
1379
|
+
for (var a; e.callQueue.length > 0; ) {
|
|
1380
|
+
a = e.callQueue.shift();
|
|
1381
|
+
var i = a[0];
|
|
1382
|
+
i in this && this[i].apply(this, a.slice(1));
|
|
1383
|
+
}
|
|
1384
|
+
for (this._normalizeEvents(); this._eventQueue.length > 0; ) {
|
|
1385
|
+
var o = this._eventQueue.length == 1;
|
|
1386
|
+
this._spoolData(this._eventQueue.shift(), !o);
|
|
1387
|
+
}
|
|
1388
|
+
} catch (c) {
|
|
1389
|
+
e._error("Process queue exception " + c.toString());
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
t && window.setTimeout(function() {
|
|
1393
|
+
e._asyncDelaysFlag || r.processQueue(!0);
|
|
1394
|
+
}, this._reportingInterval);
|
|
1395
|
+
}, e.Library.prototype.setTransportMethod = function(t) {
|
|
1396
|
+
t === "beacon" && "sendBeacon" in window.navigator ? (e._transportMethod = "beacon", e._activeTransport = new e.SendBeaconTransport(this._targetUrls)) : (e._transportMethod = "xhr", e._activeTransport = new e.XHRTransport(this._targetUrls));
|
|
1397
|
+
};
|
|
1398
|
+
var s = "https://";
|
|
1399
|
+
s += "rat.rakuten.co.jp";
|
|
1400
|
+
var _ = new e.Library(s);
|
|
1401
|
+
return e._activeTransport = e._transportMethod === "beacon" && "sendBeacon" in window.navigator ? new e.SendBeaconTransport(_._targetUrls) : new e.XHRTransport(_._targetUrls), e.setTransportMethod = function(t) {
|
|
1402
|
+
_.setTransportMethod(t);
|
|
1403
|
+
}, e.getTransportMethod = function() {
|
|
1404
|
+
return e._transportMethod;
|
|
1405
|
+
}, e.processImmediate = function() {
|
|
1406
|
+
_.processQueue(!1);
|
|
1407
|
+
}, e.resetPageId = function() {
|
|
1408
|
+
return _.resetPageId();
|
|
1409
|
+
}, e.callQueue = n, setTimeout(function() {
|
|
1410
|
+
_.processQueue(!0);
|
|
1411
|
+
}, 1), e.live = !0, e;
|
|
1412
|
+
}
|
|
1413
|
+
var ne = /* @__PURE__ */ ((n) => (n.XHR = "xhr", n.BEACON = "beacon", n))(ne || {}), Ie = /* @__PURE__ */ ((n) => (n.JP = "rat.rakuten.co.jp", n.JP_SEC = "secure.rat.rakuten.co.jp", n.FR = "rat.rakuten.fr", n.DE = "rat.rakuten.de", n.ES = "rat.rakuten.es", n.UK = "rat.rakuten.co.uk", n.STG_JP = "stg.rat.rakuten.co.jp", n.STG_JP_SEC = "stg.secure.rat.rakuten.co.jp", n.CHECK_JP = "check.rat.rakuten.co.jp", n.CHECK_JP_SEC = "check.secure.rat.rakuten.co.jp", n))(Ie || {}), Ce = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Ce || {}), Ae = /* @__PURE__ */ ((n) => (n[n.TEN = 10] = "TEN", n[n.TWENTY = 20] = "TWENTY", n[n.THIRTY = 30] = "THIRTY", n[n.FORTY = 40] = "FORTY", n[n.FIFTY = 50] = "FIFTY", n))(Ae || {}), Le = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Le || {}), Re = /* @__PURE__ */ ((n) => (n[n.NOT_APPLIED = 0] = "NOT_APPLIED", n[n.APPLIED = 1] = "APPLIED", n))(Re || {}), Oe = /* @__PURE__ */ ((n) => (n[n.V_1 = -1] = "V_1", n[n.V1 = 1] = "V1", n[n.V2 = 2] = "V2", n[n.V3 = 3] = "V3", n[n.V4 = 4] = "V4", n[n.V5 = 5] = "V5", n))(Oe || {}), Ne = /* @__PURE__ */ ((n) => (n[n.V1 = 1] = "V1", n[n.V2 = 2] = "V2", n))(Ne || {}), be = /* @__PURE__ */ ((n) => (n[n.TYPE0 = 0] = "TYPE0", n[n.TYPE1 = 1] = "TYPE1", n[n.TYPE2 = 2] = "TYPE2", n[n.TYPE3 = 3] = "TYPE3", n[n.TYPE255 = 255] = "TYPE255", n))(be || {}), Ue = /* @__PURE__ */ ((n) => (n.OR = "o", n.AND = "a", n.NO = "x", n))(Ue || {}), we = /* @__PURE__ */ ((n) => (n.PC = "PC", n.PC_LOWER = "pc", n.SP = "SP", n.SP_LOWER = "sp", n.TB = "TB", n.TB_LOWER = "tb", n.RESP = "RESP", n.RESP_LOWER = "resp", n))(we || {}), Ve = /* @__PURE__ */ ((n) => (n.TOP = "top", n.SEARCH = "search", n.SHOP_ITEM = "shop_item", n.CART_MODIFY = "cart_modify", n.CART_CHECKOUT = "cart_checkout", n))(Ve || {}), ke = /* @__PURE__ */ ((n) => (n[n.V0 = 0] = "V0", n[n.V1 = 1] = "V1", n))(ke || {}), Me = /* @__PURE__ */ ((n) => (n.NONE = "none", n.OR = "or", n.GENRE = "genre", n.NGRAM = "ngram", n))(Me || {});
|
|
1414
|
+
const Fe = {
|
|
1415
|
+
rpCookie: "Rp",
|
|
1416
|
+
rzCookie: "Rz",
|
|
1417
|
+
abTest: "abtest",
|
|
1418
|
+
testTargeting: "abtest_target",
|
|
1419
|
+
accountId: "acc",
|
|
1420
|
+
affiliateId: "afid",
|
|
1421
|
+
adultFlag: "aflg",
|
|
1422
|
+
serviceId: "aid",
|
|
1423
|
+
appName: "app_name",
|
|
1424
|
+
appVersion: "app_ver",
|
|
1425
|
+
area: "area",
|
|
1426
|
+
adobeSiteSection: "assc",
|
|
1427
|
+
booksGenre: "bgenre",
|
|
1428
|
+
brand: "brand",
|
|
1429
|
+
cartState: "cart",
|
|
1430
|
+
campaignCode: "cc",
|
|
1431
|
+
checkout: "chkout",
|
|
1432
|
+
checkpoint: "chkpt",
|
|
1433
|
+
idfaCookie: "cka",
|
|
1434
|
+
persistentCookie: "ckp",
|
|
1435
|
+
sessionCookie: "cks",
|
|
1436
|
+
sessionCookieV2: "cks2",
|
|
1437
|
+
contentLanguage: "cntln",
|
|
1438
|
+
componentId: "compid",
|
|
1439
|
+
countryCode: "country",
|
|
1440
|
+
couponPrice: "coupon_price",
|
|
1441
|
+
couponId: "couponid",
|
|
1442
|
+
customParameters: "cp",
|
|
1443
|
+
customerId: "customerid",
|
|
1444
|
+
cvEvent: "cv",
|
|
1445
|
+
currencyCode: "cycode",
|
|
1446
|
+
currencyCodeList: "cycodelist",
|
|
1447
|
+
deviceLanguage: "dln",
|
|
1448
|
+
eeid: "eeid",
|
|
1449
|
+
errorList: "errorlist",
|
|
1450
|
+
errors: "errors",
|
|
1451
|
+
excludeQuery: "esq",
|
|
1452
|
+
eventType: "etype",
|
|
1453
|
+
genre: "genre",
|
|
1454
|
+
goalId: "gol",
|
|
1455
|
+
itemGenre: "igenre",
|
|
1456
|
+
itemGenreNamePath: "igenrenamepath",
|
|
1457
|
+
itemGenrePath: "igenrepath",
|
|
1458
|
+
rmsItemNumber: "ino",
|
|
1459
|
+
itemTag: "itag",
|
|
1460
|
+
itemName: "item_name",
|
|
1461
|
+
itemId: "itemid",
|
|
1462
|
+
itemUrl: "itemurl",
|
|
1463
|
+
language: "lang",
|
|
1464
|
+
location: "loc",
|
|
1465
|
+
requestLocationActionParameters: "action_params",
|
|
1466
|
+
maker: "maker",
|
|
1467
|
+
batteryUsage: "mbat",
|
|
1468
|
+
mobileCarrierName: "mcn",
|
|
1469
|
+
mobileCarrierNameForDualSim: "mcnd",
|
|
1470
|
+
media: "media",
|
|
1471
|
+
eventName: "event_name",
|
|
1472
|
+
mobileNavigationTime: "mnavtime",
|
|
1473
|
+
mobileDeviceBrandModel: "model",
|
|
1474
|
+
mobileOrientation: "mori",
|
|
1475
|
+
mobileOs: "mos",
|
|
1476
|
+
m3rCookie: "m3_r",
|
|
1477
|
+
itemCount: "ni",
|
|
1478
|
+
itemCountOrder: "ni_order",
|
|
1479
|
+
orAnd: "oa",
|
|
1480
|
+
orderId: "order_id",
|
|
1481
|
+
orderList: "order_list",
|
|
1482
|
+
payment: "payment",
|
|
1483
|
+
pageLayout: "pgl",
|
|
1484
|
+
pageName: "pgn",
|
|
1485
|
+
pageSection: "pgs",
|
|
1486
|
+
pageType: "pgt",
|
|
1487
|
+
phoenixPattern: "phoenix_pattern",
|
|
1488
|
+
pointPrice: "point_price",
|
|
1489
|
+
batteryChargingStatus: "powerstatus",
|
|
1490
|
+
productCode: "prdctcd",
|
|
1491
|
+
price: "price",
|
|
1492
|
+
publisher: "publisher",
|
|
1493
|
+
ranCode: "rancode",
|
|
1494
|
+
requestResult: "reqc",
|
|
1495
|
+
reservationMadeDate: "rescreadate",
|
|
1496
|
+
reservedDate: "resdate",
|
|
1497
|
+
reservationId: "reservation_id",
|
|
1498
|
+
resultLayout: "reslayout",
|
|
1499
|
+
rgCookie: "Rg",
|
|
1500
|
+
searchCondition: "scond",
|
|
1501
|
+
searchEntity: "search_entity",
|
|
1502
|
+
serviceType: "service",
|
|
1503
|
+
shopGenre: "sgenre",
|
|
1504
|
+
shippingMethod: "shipping",
|
|
1505
|
+
shippingFee: "shipping_fee",
|
|
1506
|
+
shopId: "shopid",
|
|
1507
|
+
shopIdList: "shopidlist",
|
|
1508
|
+
shopUrl: "shopurl",
|
|
1509
|
+
shopUrlList: "shopurllist",
|
|
1510
|
+
sphinxPattern: "sphinx_pattern",
|
|
1511
|
+
searchQuery: "sq",
|
|
1512
|
+
scrollViewed: "sresv",
|
|
1513
|
+
retryType: "srt",
|
|
1514
|
+
ssrCookie: "ss_r",
|
|
1515
|
+
siteSection: "ssc",
|
|
1516
|
+
tag: "tag",
|
|
1517
|
+
targetElement: "target_ele",
|
|
1518
|
+
totalPrice: "total_price",
|
|
1519
|
+
clientProvidedTimestamp: "ts1",
|
|
1520
|
+
userId: "userid",
|
|
1521
|
+
variantid: "variantid",
|
|
1522
|
+
itemVariation: "variation",
|
|
1523
|
+
widowbirdPattern: "wb_pattern",
|
|
1524
|
+
userCookieJs: "_ra"
|
|
1525
|
+
};
|
|
1526
|
+
class De {
|
|
1527
|
+
constructor({
|
|
1528
|
+
ral: e,
|
|
1529
|
+
accountId: s,
|
|
1530
|
+
serviceId: _
|
|
1531
|
+
}) {
|
|
1532
|
+
P(this, "ral"), P(this, "accountId"), P(this, "serviceId"), this.ral = e, this.accountId = s, this.serviceId = _;
|
|
1533
|
+
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Set the main receiver for the RAL instance.
|
|
1536
|
+
*
|
|
1537
|
+
* @param ral - The RAL instance to configure.
|
|
1538
|
+
* @param mainReceiver - The main receiver endpoints to set.
|
|
1539
|
+
*
|
|
1540
|
+
* @remarks
|
|
1541
|
+
* This method can only be called before sending an event due to the constraints of the current RAL implementation.
|
|
1542
|
+
*/
|
|
1543
|
+
setMainReceiver(e) {
|
|
1544
|
+
this.ral.callQueue.push(["setMainReceiver", e]);
|
|
1545
|
+
}
|
|
1546
|
+
setTransportMethod(e) {
|
|
1547
|
+
this.ral.callQueue.push(["setTransportMethod", e]);
|
|
1548
|
+
}
|
|
1549
|
+
setCustomCookies(e) {
|
|
1550
|
+
this.ral.callQueue.push(["setCookieNames", JSON.stringify(e)]);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
function Be(n) {
|
|
1554
|
+
const e = {};
|
|
1555
|
+
for (const s in n)
|
|
1556
|
+
if (Object.prototype.hasOwnProperty.call(n, s)) {
|
|
1557
|
+
const _ = Fe[s];
|
|
1558
|
+
_ && (e[_] = n[s]);
|
|
1559
|
+
}
|
|
1560
|
+
return e;
|
|
1561
|
+
}
|
|
1562
|
+
const He = () => {
|
|
1563
|
+
const n = navigator.userAgent, e = n.toLowerCase();
|
|
1564
|
+
if (e.search(/ipod|iphone/) > -1)
|
|
1565
|
+
return "iPhone";
|
|
1566
|
+
if (e.search("ipad") > -1)
|
|
1567
|
+
return "iPad";
|
|
1568
|
+
if (e.search("android") > -1 && e.search("mobile safari") === -1) {
|
|
1569
|
+
const s = e.match(/android (\d)\./);
|
|
1570
|
+
if (s && parseInt(s[1], 10) > 2)
|
|
1571
|
+
return "Android Tablet";
|
|
1572
|
+
} else {
|
|
1573
|
+
if (e.search("android") > -1)
|
|
1574
|
+
return "Android Mobile";
|
|
1575
|
+
if (e.search("blackberry") > -1)
|
|
1576
|
+
return "BlackBerry";
|
|
1577
|
+
if (e.search("windows phone") > -1)
|
|
1578
|
+
return "Windows Phone";
|
|
1579
|
+
if (e.search("windows ce") > -1)
|
|
1580
|
+
return "Windows Mobile";
|
|
1581
|
+
if (e.search(/nintendo wii|nintendo ds|playstation/) > -1)
|
|
1582
|
+
return "GAME";
|
|
1583
|
+
if (e.search("symbian") > -1)
|
|
1584
|
+
return "Symbian";
|
|
1585
|
+
if (e.search(/docomo|foma|kddi|softbank|vodafone|j-phone|willcom/) > -1)
|
|
1586
|
+
return "Feature phone";
|
|
1587
|
+
if (n.search(/Win|Mac/) != -1)
|
|
1588
|
+
return "PC";
|
|
1589
|
+
}
|
|
1590
|
+
return "Others";
|
|
1591
|
+
}, Ke = "0.6.2";
|
|
1592
|
+
class We {
|
|
1593
|
+
/**
|
|
1594
|
+
* Creates a new Tracker instance.
|
|
1595
|
+
*
|
|
1596
|
+
* @param options - Configuration options for the tracker
|
|
1597
|
+
* @param options.accountId - Your Rakuten Analytics account ID
|
|
1598
|
+
* @param options.serviceId - Your Rakuten Analytics service ID
|
|
1599
|
+
* @param options.transportMethod - Method for sending data (beacon or xhr)
|
|
1600
|
+
* @param options.mainReceiver - The endpoint to send analytics data to
|
|
1601
|
+
* @param options.customCookies - Optional custom cookies to include with requests
|
|
1602
|
+
* @param options.sdkSource - SDK source identifier (defaults to 'rat-ts')
|
|
1603
|
+
* @param options.sdkVersion - SDK version (defaults to rat-ts package version)
|
|
1604
|
+
*
|
|
1605
|
+
* @example Basic initialization
|
|
1606
|
+
* ```typescript
|
|
1607
|
+
* const tracker = new Tracker({
|
|
1608
|
+
* accountId: 123,
|
|
1609
|
+
* serviceId: 456,
|
|
1610
|
+
* transportMethod: TransportMethod.BEACON,
|
|
1611
|
+
* mainReceiver: ReceiverEndpoint.JP,
|
|
1612
|
+
* customCookies: { 'custom_param': 'value' }
|
|
1613
|
+
* });
|
|
1614
|
+
* ```
|
|
1615
|
+
*
|
|
1616
|
+
* @example With custom SDK identification (for wrapper libraries)
|
|
1617
|
+
* ```typescript
|
|
1618
|
+
* const tracker = new Tracker({
|
|
1619
|
+
* accountId: 123,
|
|
1620
|
+
* serviceId: 456,
|
|
1621
|
+
* sdkSource: 'rat-react',
|
|
1622
|
+
* sdkVersion: '0.2.1'
|
|
1623
|
+
* });
|
|
1624
|
+
* ```
|
|
1625
|
+
*/
|
|
1626
|
+
constructor(e) {
|
|
1627
|
+
P(this, "ral"), P(this, "ralConfig"), this.ral = ve();
|
|
1628
|
+
const s = e.sdkSource ?? "rat-ts", _ = e.sdkVersion ?? Ke;
|
|
1629
|
+
this.ral.callQueue.push(["setSdkSource", s]), this.ral.callQueue.push(["setSdkVersion", _]), this.ralConfig = new De({ ral: this.ral, ...e }), this.ralConfig.setTransportMethod(e.transportMethod ?? ne.BEACON), e.mainReceiver && this.ralConfig.setMainReceiver(e.mainReceiver), e.customCookies && this.ralConfig.setCustomCookies(e.customCookies);
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Sends a generic analytics event.
|
|
1633
|
+
*
|
|
1634
|
+
* This is the base method for sending any type of event. Most users should prefer
|
|
1635
|
+
* the more specific methods like `sendPageviewEvent()` or `sendClickEvent()`.
|
|
1636
|
+
*
|
|
1637
|
+
* @param event - The event object containing type, parameters, and custom data
|
|
1638
|
+
* @param event.type - The type of event ('pv', 'click', 'appear', 'async', 'scroll')
|
|
1639
|
+
* @param event.params - Standard analytics parameters
|
|
1640
|
+
* @param event.customParams - Custom parameters specific to your implementation
|
|
1641
|
+
* @param event.cvEvents - Conversion events for tracking business metrics
|
|
1642
|
+
* @param event.autoCollectedParams - Array of auto-collected parameter names to include (e.g., ['url', 'ua', 'ref'])
|
|
1643
|
+
*
|
|
1644
|
+
* @example
|
|
1645
|
+
* ```typescript
|
|
1646
|
+
* tracker.sendEvent({
|
|
1647
|
+
* type: 'click',
|
|
1648
|
+
* params: { pageName: 'search' },
|
|
1649
|
+
* customParams: { clktgt: 'button-primary' },
|
|
1650
|
+
* cvEvents: { 'purchase_gms': 1200 },
|
|
1651
|
+
* autoCollectedParams: ['url', 'ua']
|
|
1652
|
+
* });
|
|
1653
|
+
* ```
|
|
1654
|
+
*/
|
|
1655
|
+
sendEvent(e) {
|
|
1656
|
+
const { type: s, params: _, customParams: t, cvEvents: r, autoCollectedParams: a } = e, { accountId: i, serviceId: o } = this.ralConfig;
|
|
1657
|
+
if (this.ral.callQueue.push(["setAccountId", i]), this.ral.callQueue.push(["setServiceId", o]), this.ral.callQueue.push([
|
|
1658
|
+
"setParameters",
|
|
1659
|
+
{ js_ua: navigator.userAgent }
|
|
1660
|
+
]), this.ral.callQueue.push([
|
|
1661
|
+
"setParameters",
|
|
1662
|
+
{ js_devtype: He() }
|
|
1663
|
+
]), _) {
|
|
1664
|
+
const c = Be(_);
|
|
1665
|
+
this.ral.callQueue.push(["setParameters", c]);
|
|
1666
|
+
}
|
|
1667
|
+
t && this.ral.callQueue.push(["setCustomParameters", t]), r && this.ral.callQueue.push(["setParameters", { cv: r }]), a && a.length > 0 && this.ral.callQueue.push(["setOptions", a]), this.ral.callQueue.push(["setEvent", s]);
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Sends a pageview event to track page visits.
|
|
1671
|
+
*
|
|
1672
|
+
* This method should be called when a user views a page on your website.
|
|
1673
|
+
* It includes built-in compatibility logic for certain account/service combinations
|
|
1674
|
+
* and automatically sets default values for pageName and siteSection if not provided.
|
|
1675
|
+
*
|
|
1676
|
+
* @param options - Pageview event parameters
|
|
1677
|
+
* @param options.params - Standard analytics parameters for the pageview
|
|
1678
|
+
* @param options.params.pageName - Name of the page being viewed
|
|
1679
|
+
* @param options.params.siteSection - Section of the site containing this page
|
|
1680
|
+
* @param options.customParams - Custom parameters for additional tracking data
|
|
1681
|
+
* @param options.cvEvents - Conversion events to track with this pageview
|
|
1682
|
+
* @param options.autoCollectedParams - Array of auto-collected parameter names to include (e.g., ['url', 'ref'])
|
|
1683
|
+
*
|
|
1684
|
+
* @example Basic pageview
|
|
1685
|
+
* ```typescript
|
|
1686
|
+
* tracker.sendPageviewEvent({
|
|
1687
|
+
* params: {
|
|
1688
|
+
* pageName: 'home',
|
|
1689
|
+
* siteSection: 'main'
|
|
1690
|
+
* }
|
|
1691
|
+
* });
|
|
1692
|
+
* ```
|
|
1693
|
+
*
|
|
1694
|
+
* @example Pageview with conversion tracking
|
|
1695
|
+
* ```typescript
|
|
1696
|
+
* tracker.sendPageviewEvent({
|
|
1697
|
+
* params: { pageName: 'checkout-complete' },
|
|
1698
|
+
* cvEvents: {
|
|
1699
|
+
* 'purchase_gms': 3400,
|
|
1700
|
+
* 'purchase_order': 1
|
|
1701
|
+
* }
|
|
1702
|
+
* });
|
|
1703
|
+
* ```
|
|
1704
|
+
*
|
|
1705
|
+
* @example Pageview with auto-collected params
|
|
1706
|
+
* ```typescript
|
|
1707
|
+
* tracker.sendPageviewEvent({
|
|
1708
|
+
* params: { pageName: 'product-detail' },
|
|
1709
|
+
* autoCollectedParams: ['url', 'ref', 'ua']
|
|
1710
|
+
* });
|
|
1711
|
+
* ```
|
|
1712
|
+
*/
|
|
1713
|
+
sendPageviewEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
|
|
1714
|
+
if (e) {
|
|
1715
|
+
const { accountId: r, serviceId: a } = this.ralConfig;
|
|
1716
|
+
if (!e.pageName && r === 7 && a === 12) {
|
|
1717
|
+
let i = location.pathname.replace(".html", "").replace("index", "");
|
|
1718
|
+
i == "/" && (i = "top"), e.pageName = i;
|
|
1719
|
+
}
|
|
1720
|
+
if (!e.pageName || !e.siteSection) {
|
|
1721
|
+
const i = (document.location.href || "").match(
|
|
1722
|
+
/https?:\/\/[^/$#?]+(\/[^$#?]+)?/
|
|
1723
|
+
);
|
|
1724
|
+
i && (e.pageName || (e.pageName = i[1] || "top"), e.siteSection || (e.siteSection = i[1] && i[1].split("/")[1] ? "/" + i[1].split("/")[1] : "top"));
|
|
1725
|
+
}
|
|
1726
|
+
r === 1 && a === 1 && document.getElementById("sc_betaInfo") && (e.testTargeting = e.testTargeting || {}, typeof e.testTargeting == "object" && e.testTargeting !== null && (e.testTargeting.ichiba_top = document.getElementById("sc_betaInfo").value));
|
|
1727
|
+
}
|
|
1728
|
+
this.sendEvent({ type: "pv", params: e, customParams: s, cvEvents: _, autoCollectedParams: t });
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Sends a click event to track user interactions.
|
|
1732
|
+
*
|
|
1733
|
+
* This method should be called when a user clicks on tracked elements like buttons,
|
|
1734
|
+
* links, or other interactive components. By default, it automatically captures
|
|
1735
|
+
* URL and user agent information (['url', 'ua']).
|
|
1736
|
+
*
|
|
1737
|
+
* @param options - Click event parameters
|
|
1738
|
+
* @param options.params - Standard analytics parameters for the click
|
|
1739
|
+
* @param options.params.pageType - Type of page where the click occurred
|
|
1740
|
+
* @param options.customParams - Custom parameters for additional click tracking
|
|
1741
|
+
* @param options.customParams.clktgt - Click target identifier
|
|
1742
|
+
* @param options.cvEvents - Conversion events triggered by this click
|
|
1743
|
+
* @param options.autoCollectedParams - Additional auto-collected params to combine with defaults ['url', 'ua']
|
|
1744
|
+
*
|
|
1745
|
+
* @example Basic click tracking (uses default ['url', 'ua'])
|
|
1746
|
+
* ```typescript
|
|
1747
|
+
* tracker.sendClickEvent({
|
|
1748
|
+
* params: { pageType: 'search' },
|
|
1749
|
+
* customParams: { clktgt: 'search-result-item' }
|
|
1750
|
+
* });
|
|
1751
|
+
* ```
|
|
1752
|
+
*
|
|
1753
|
+
* @example Click with conversion
|
|
1754
|
+
* ```typescript
|
|
1755
|
+
* tracker.sendClickEvent({
|
|
1756
|
+
* params: { pageType: 'product' },
|
|
1757
|
+
* customParams: { clktgt: 'add-to-cart' },
|
|
1758
|
+
* cvEvents: { 'cart_add': 1 }
|
|
1759
|
+
* });
|
|
1760
|
+
* ```
|
|
1761
|
+
*
|
|
1762
|
+
* @example Click with additional auto-collected params (combined with defaults)
|
|
1763
|
+
* ```typescript
|
|
1764
|
+
* // This will collect ['url', 'ua', 'ref'] - the 'ref' is added to defaults
|
|
1765
|
+
* tracker.sendClickEvent({
|
|
1766
|
+
* params: { pageType: 'article' },
|
|
1767
|
+
* customParams: { clktgt: 'share-button' },
|
|
1768
|
+
* autoCollectedParams: ['ref']
|
|
1769
|
+
* });
|
|
1770
|
+
* ```
|
|
1771
|
+
*/
|
|
1772
|
+
sendClickEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
|
|
1773
|
+
e && e.pageType && this.ral.callQueue.push(["setPageType", e.pageType]);
|
|
1774
|
+
const r = ["url", "ua"], a = t ? [.../* @__PURE__ */ new Set([...r, ...t])] : r;
|
|
1775
|
+
this.sendEvent({ type: "click", params: e, customParams: s, cvEvents: _, autoCollectedParams: a });
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Resets the page ID in the RAL instance.
|
|
1779
|
+
*
|
|
1780
|
+
* This method delegates to the underlying RAL's resetPageId method.
|
|
1781
|
+
*/
|
|
1782
|
+
resetPageId() {
|
|
1783
|
+
this.ral.resetPageId();
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Processes events in the queue immediately.
|
|
1787
|
+
*
|
|
1788
|
+
* This method delegates to the underlying RAL's processImmediate method.
|
|
1789
|
+
*/
|
|
1790
|
+
processImmediate() {
|
|
1791
|
+
this.ral.processImmediate();
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
const Ge = "0.3.1-rc.716ed0a", je = "rat-react", Ye = Ge;
|
|
1795
|
+
function M(n) {
|
|
1796
|
+
return new We({
|
|
1797
|
+
...n,
|
|
1798
|
+
sdkSource: je,
|
|
1799
|
+
sdkVersion: Ye
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
const ze = (n) => {
|
|
1803
|
+
const { accountId: e, serviceId: s } = n, [_, t] = F(null);
|
|
1804
|
+
return R(() => {
|
|
1805
|
+
const r = M(n);
|
|
1806
|
+
t(r);
|
|
1807
|
+
}, [e, s]), _;
|
|
1808
|
+
}, ae = se(
|
|
1809
|
+
void 0
|
|
1810
|
+
), Xe = () => {
|
|
1811
|
+
const n = ce(ae);
|
|
1812
|
+
if (!n)
|
|
1813
|
+
throw new Error("useTrackerContext must be used within a TrackerProvider");
|
|
1814
|
+
return n;
|
|
1815
|
+
}, Je = ({
|
|
1816
|
+
children: n,
|
|
1817
|
+
defaultTrackers: e = []
|
|
1818
|
+
}) => {
|
|
1819
|
+
const [s, _] = F({});
|
|
1820
|
+
R(() => {
|
|
1821
|
+
const a = {};
|
|
1822
|
+
e.forEach(({ key: i, options: o }) => {
|
|
1823
|
+
a[i] = M(o);
|
|
1824
|
+
}), _(a);
|
|
1825
|
+
}, [e]);
|
|
1826
|
+
const t = (a, i) => {
|
|
1827
|
+
const o = M(i);
|
|
1828
|
+
_((c) => ({ ...c, [a]: o }));
|
|
1829
|
+
}, r = (a) => {
|
|
1830
|
+
const i = s[a];
|
|
1831
|
+
if (!i) {
|
|
1832
|
+
const o = Object.keys(s);
|
|
1833
|
+
console.warn(
|
|
1834
|
+
`Tracker with key "${a}" not found. Available trackers: ${o.length > 0 ? o.join(", ") : "none"}`
|
|
1835
|
+
);
|
|
1836
|
+
}
|
|
1837
|
+
return i;
|
|
1838
|
+
};
|
|
1839
|
+
return /* @__PURE__ */ z(ae.Provider, { value: { getTracker: r, addTracker: t }, children: n });
|
|
1840
|
+
};
|
|
1841
|
+
function Qe(n) {
|
|
1842
|
+
const { onChange: e, once: s = !0 } = n, [_, t] = F(!1), r = K(null), a = K(null), i = _e(
|
|
1843
|
+
(o) => {
|
|
1844
|
+
o.forEach((c) => {
|
|
1845
|
+
var u;
|
|
1846
|
+
c.isIntersecting ? (t(!0), e == null || e(!0), s && ((u = r.current) == null || u.disconnect())) : (t(!1), e == null || e(!1));
|
|
1847
|
+
});
|
|
1848
|
+
},
|
|
1849
|
+
[e, s]
|
|
1850
|
+
);
|
|
1851
|
+
return R(() => {
|
|
1852
|
+
r.current = new IntersectionObserver(i, {
|
|
1853
|
+
root: null,
|
|
1854
|
+
rootMargin: "0px",
|
|
1855
|
+
threshold: 0.1
|
|
1856
|
+
// always partial visibility
|
|
1857
|
+
});
|
|
1858
|
+
const o = a.current;
|
|
1859
|
+
return o && r.current.observe(o), () => {
|
|
1860
|
+
r.current && r.current.disconnect();
|
|
1861
|
+
};
|
|
1862
|
+
}, [i]), { isVisible: _, containerRef: a };
|
|
1863
|
+
}
|
|
1864
|
+
const $e = ({
|
|
1865
|
+
children: n,
|
|
1866
|
+
tracker: e,
|
|
1867
|
+
id: s,
|
|
1868
|
+
onChange: _,
|
|
1869
|
+
once: t = !0,
|
|
1870
|
+
style: r,
|
|
1871
|
+
...a
|
|
1872
|
+
}) => {
|
|
1873
|
+
const { isVisible: i, containerRef: o } = Qe({
|
|
1874
|
+
onChange: _,
|
|
1875
|
+
once: t
|
|
1876
|
+
});
|
|
1877
|
+
return R(() => {
|
|
1878
|
+
i && (e && typeof e.sendEvent == "function" ? e.sendEvent({
|
|
1879
|
+
type: "appear",
|
|
1880
|
+
params: {
|
|
1881
|
+
componentId: [s]
|
|
1882
|
+
}
|
|
1883
|
+
// Add any required params here
|
|
1884
|
+
}) : console.warn(
|
|
1885
|
+
`VisibilityTracker: No tracker available for component "${s}". Event not sent.`
|
|
1886
|
+
));
|
|
1887
|
+
}, [i, e, s]), /* @__PURE__ */ z(
|
|
1888
|
+
"div",
|
|
1889
|
+
{
|
|
1890
|
+
ref: o,
|
|
1891
|
+
style: { overflow: "auto", ...r },
|
|
1892
|
+
...a,
|
|
1893
|
+
children: n
|
|
1894
|
+
}
|
|
1895
|
+
);
|
|
1896
|
+
};
|
|
1897
|
+
export {
|
|
1898
|
+
Ce as AflgEnum,
|
|
1899
|
+
Ae as ChkoutEnum,
|
|
1900
|
+
Le as IfrEnum,
|
|
1901
|
+
Re as IsscEnum,
|
|
1902
|
+
Oe as MnetwEnum,
|
|
1903
|
+
Ne as MoriEnum,
|
|
1904
|
+
be as NavtypeEnum,
|
|
1905
|
+
Ue as OaEnum,
|
|
1906
|
+
we as PglEnum,
|
|
1907
|
+
Ve as PgtEnum,
|
|
1908
|
+
ke as PowerstatusEnum,
|
|
1909
|
+
Ie as ReceiverEndpoint,
|
|
1910
|
+
Me as SrtEnum,
|
|
1911
|
+
Je as TrackerProvider,
|
|
1912
|
+
ne as TransportMethod,
|
|
1913
|
+
$e as VisibilityTracker,
|
|
1914
|
+
ze as useTracker,
|
|
1915
|
+
Xe as useTrackerContext
|
|
1916
|
+
};
|