v1.0.0
PriviMetrics 2
- ; (() => {
- var s = document.currentScript
- if (!s) return
-
- var code = s.getAttribute("data-code")
- if (!code) return
-
- var customTitle = s.getAttribute("data-title")
-
- var noTrackIp = s.getAttribute("data-no-track-ip") === "true"
-
- var endpoint = s.src.replace(/\/[^/]+$/, "/privimetrics.php")
-
- function send() {
- try {
- var displayTitle = customTitle || document.title || ""
-
- var tz = ""
- try {
- tz = Intl.DateTimeFormat().resolvedOptions().timeZone || ""
- } catch (_) { }
-
- var lang = navigator.language || navigator.userLanguage || ""
-
- var params = [
- "t=" + encodeURIComponent(code),
- "p=" + encodeURIComponent(window.location.href),
- "title=" + encodeURIComponent(displayTitle),
- "r=" + encodeURIComponent(document.referrer || "d"),
- "js=1",
- "tz=" + encodeURIComponent(tz),
- "lang=" + encodeURIComponent(lang),
- "z=" + Math.random()
- ]
-
- if (noTrackIp) {
- params.push("track-ip=false")
- }
-
- var img = new Image(1, 1)
- img.style.display = "none"
- img.src = endpoint + "?" + params.join("&")
- document.documentElement.appendChild(img)
- } catch (_) { }
- }
-
- if (document.readyState === "complete" || document.readyState === "interactive") {
- send()
- } else {
- document.addEventListener("DOMContentLoaded", send)
- }
- })()
-