forked from AllanTracker/codigos-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvanced sem Forms (Plataformas sck)
56 lines (50 loc) · 1.78 KB
/
Advanced sem Forms (Plataformas sck)
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
53
54
55
56
<script>
let prefix = ["https://pay.kiwify.com.br"];
function getParams() {
let t = "",
e = window.top.location.href,
r = new URL(e);
if (null != r) {
let a = r.searchParams.get("utm_source"),
n = r.searchParams.get("utm_medium"),
o = r.searchParams.get("utm_campaign"),
m = r.searchParams.get("utm_term"),
p = r.searchParams.get("fbclid"),
c = r.searchParams.get("utm_content");
-1 !== e.indexOf("?") && (t = `&src=${a}|${n}|${o}|${m}|${c}`);
console.log(t);
}
return t;
}
function getCookie(name) {
let match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
if (match) {
return match[2];
}
return null;
}
function updateLinks() {
var t = new URLSearchParams(window.location.search);
var sck = getCookie("Leadsf");
if (sck) {
t.append("sck", sck);
t.toString() && document.querySelectorAll("a").forEach(function(e) {
for (let r = 0; r < prefix.length; r++) {
if (-1 !== e.href.indexOf(prefix[r])) {
if (-1 === e.href.indexOf("?")) {
e.href += "?" + t.toString() + getParams();
} else {
e.href += "&" + t.toString() + getParams();
}
}
}
});
} else {
// Tenta novamente após 100ms se o cookie ainda não estiver presente
setTimeout(updateLinks, 100);
}
}
window.addEventListener('load', function() {
updateLinks();
});
</script>