-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathtest2.html
51 lines (44 loc) · 2.56 KB
/
test2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul>
<li><a href='https://developer.mozilla.org/en-US/docs/Web/API/WebVR_API'>WebVR API on MDN</a></li>
<li><a href='../webxr-experiments/'>more experiments</a></li>
<li><a href='../jinglesmash-ecs/'>new jinglesmash</a></li>
<li><a href='https://joshbigmac.ngrok.io/'>local</a></li>
</ul>
<script>
(function(a,b,c){var d=a.history,e=document,f=navigator||{},g=localStorage,
h=encodeURIComponent,i=d.pushState,k=function(){return Math.random().toString(36)},
l=function(){return g.cid||(g.cid=k()),g.cid},m=function(r){var s=[];for(var t in r)
r.hasOwnProperty(t)&&void 0!==r[t]&&s.push(h(t)+"="+h(r[t]));return s.join("&")},
n=function(r,s,t,u,v,w,x){var z="https://www.google-analytics.com/collect",
A=m({v:"1",ds:"web",aip:c.anonymizeIp?1:void 0,tid:b,cid:l(),t:r||"pageview",
sd:c.colorDepth&&screen.colorDepth?screen.colorDepth+"-bits":void 0,dr:e.referrer||
void 0,dt:e.title,dl:e.location.origin+e.location.pathname+e.location.search,ul:c.language?
(f.language||"").toLowerCase():void 0,de:c.characterSet?e.characterSet:void 0,
sr:c.screenSize?(a.screen||{}).width+"x"+(a.screen||{}).height:void 0,vp:c.screenSize&&
a.visualViewport?(a.visualViewport||{}).width+"x"+(a.visualViewport||{}).height:void 0,
ec:s||void 0,ea:t||void 0,el:u||void 0,ev:v||void 0,exd:w||void 0,exf:"undefined"!=typeof x&&
!1==!!x?0:void 0});if(f.sendBeacon){f.sendBeacon(z,A); console.log("sent ",z,A)}else{var y=new XMLHttpRequest;
y.open("POST",z,!0),y.send(A)}};d.pushState=function(r){return"function"==typeof d.onpushstate&&
d.onpushstate({state:r}),setTimeout(n,c.delay||10),i.apply(d,arguments)},n(),
a.ma={trackEvent:function o(r,s,t,u){console.log(`trackevent ${r} ${s} ${t} ${u}`); return n("event",r,s,t,u)},
trackException:function q(r,s){return n("exception",null,null,null,null,r,s)}}})
(window,"UA-122855516-1",{anonymizeIp:false,colorDepth:true,characterSet:true,screenSize:true,language:true});
ma.trackEvent('navigation','pageload','main',0)
document.querySelectorAll('a').forEach(a => {
console.log("got a link",a.getAttribute('href'))
a.addEventListener('click',(e)=>{
// e.preventDefault()
console.log("intercepting the post")
ma.trackEvent('navigation','navlink',a.getAttribute('href'),1)
})
})
</script>
</body>
</html>