-
Notifications
You must be signed in to change notification settings - Fork 3
/
tag-rocket-early-monitoring.html
92 lines (83 loc) · 2.28 KB
/
tag-rocket-early-monitoring.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!--
{{! This needs to be placed right at the top of the head section }}
Web Site Advantage: Tag Rocket Early Monitoring [v1.0]
https://bigcommerce.websiteadvantage.com.au/tag-rocket/articles/tag-rocket-api/
Copyright (C) 2021 Web Site Advantage
-->
<script data-cfasync="false">
!function(w,t,c,x){
w[t]={};
var T=w[t],i,s,o,f,e=function(e,n,f,o){
if(e.addEventListener){
e.addEventListener(n,f,o)
}else if(w.attachEvent){
e.attachEvent('on'+n,f)
}
};
// errors
if(!T.ef){
T.eq=T.eq||[];
T.ef=function(){
T.eq.push(arguments)
};
if(typeof w.onerror=='object')e(w,'error',function(){
T.ef.apply(T,arguments)
},{passive:true,capture:true});
}
// console errors
if(!T.cf){
T.cq=T.cq||[];
T.cf=function(){
T.cq.push(arguments)
};
i=c.error;
c.error=function(){
i.apply(c,arguments);
T.cf.apply(T,arguments)
}
}
// XMLHttpRequest
if(!T.xf&&x){
T.xq=T.xq||[];
T.xf=function(r){
T.xq.push(r);
};
o=x.open;
if(o){
x.open=function(m,u){
this.rurl=u;
return o.apply(this,arguments);
}
}
s=x.send;
if (s&&s.apply){
x.send=function(){
var t=this;
e(t,'readystatechange',function(){
if(t.readyState==4&&(t.status>399||t.status==0))T.xf(t)
});
return s.apply(t,arguments)
}
}
}
// fetch
if(!T.ff){
T.fq=T.fq||[];
T.ff=function(r){T.fq.push(r)};
f=w.fetch;
if(f&&f.apply){
w.fetch=function(u){
return f.apply(this,arguments).then(function(r){
if(r.status>399){
T.ff({url:r.url,message:r.status});
}
return r
}).catch(function(e){
T.ff({url:u.url||u,message:e.stack||e.message||e});
throw e
})
}
}
}
}(window,"TagRocket",console,XMLHttpRequest.prototype)
</script>