-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfaenz.js
More file actions
52 lines (52 loc) · 1.75 KB
/
faenz.js
File metadata and controls
52 lines (52 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
!(function () {
"use strict";
var a = window.location,
r = window.document,
o = r.currentScript,
s = o.getAttribute("data-api") || new URL(o.src).origin + "/api/event";
function l(t) {
console.warn("Ignoring Event: " + t);
}
function t(t, e) {
if (/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(a.hostname) || "file:" === a.protocol) return l("localhost");
if (!(window._phantom || window.__nightmare || window.navigator.webdriver || window.Cypress)) {
try {
if ("true" == window.localStorage.faenz_ignore) return l("localStorage flag");
} catch (t) {}
var i = {};
(i.n = t),
(i.u = a.href),
(i.d = o.getAttribute("data-domain")),
(i.r = r.referrer || null),
(i.w = window.innerWidth),
e && e.meta && (i.m = JSON.stringify(e.meta)),
e && e.props && (i.p = JSON.stringify(e.props));
var n = new XMLHttpRequest();
n.open("POST", s, !0),
n.setRequestHeader("Content-Type", "application/json"),
n.send(JSON.stringify(i)),
(n.onreadystatechange = function () {
4 == n.readyState && e && e.callback && e.callback();
});
}
}
var e = (window.faenz && window.faenz.q) || [];
window.faenz = t;
for (var i, n = 0; n < e.length; n++) t.apply(this, e[n]);
function p() {
i !== a.pathname && ((i = a.pathname), t("pageview"));
}
var w,
d = window.history;
d.pushState &&
((w = d.pushState),
(d.pushState = function () {
w.apply(this, arguments), p();
}),
window.addEventListener("popstate", p)),
"prerender" === r.visibilityState
? r.addEventListener("visibilitychange", function () {
i || "visible" !== r.visibilityState || p();
})
: p();
})();