-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.js
More file actions
38 lines (32 loc) · 954 Bytes
/
Copy pathanalytics.js
File metadata and controls
38 lines (32 loc) · 954 Bytes
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
(function () {
var img = new Image();
var params = [];
params.push(
"page=" + encodeURIComponent(location.pathname + location.search),
);
params.push("host=" + encodeURIComponent(location.host));
if (document.referrer) {
params.push("ref=" + encodeURIComponent(document.referrer));
}
var lang = navigator.language || navigator.userLanguage || "";
if (lang) {
params.push("lang=" + encodeURIComponent(lang));
}
function getQueryParam(name) {
var match = new RegExp("[?&]" + name + "=([^&]*)").exec(location.search);
return match ? decodeURIComponent(match[1].replace(/\+/g, " ")) : "";
}
[
"utm_source",
"utm_medium",
"utm_campaign",
"utm_content",
"utm_term",
].forEach(function (key) {
var value = getQueryParam(key);
if (value) {
params.push(key + "=" + encodeURIComponent(value));
}
});
img.src = "https://media.frkn.org/pixel?" + params.join("&");
})();