osm2vectortiles/_includes/google_analytics.html

41 wiersze
1.9 KiB
HTML

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-68032536-1', 'auto');
ga('send', 'pageview');
function _gaLt(event){
var el = event.srcElement || event.target;
while(el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || !el.href)){
el = el.parentNode;
}
if(el && el.href){
var link = el.href;
if(link.indexOf(location.host) == -1 && !link.match(/^javascript\:/i)){ /* external link */
/* HitCallback function to either open link in either same or new window */
var hitBack = function(link, target){
target ? window.open(link, target) : window.location.href = link;
};
/* Is target set and not _(self|parent|top)? */
var target = (el.target && !el.target.match(/^_(self|parent|top)$/i)) ? el.target : false;
/* send event with callback */
ga(
"send", "event", "Outgoing Links", link,
document.location.pathname + document.location.search,
{"hitCallback": hitBack(link, target)}
);
/* Prevent standard click */
event.preventDefault ? event.preventDefault() : event.returnValue = !1;
}
}
}
/* Attach the event to all clicks in the document after page has loaded */
var w = window;
w.addEventListener ? w.addEventListener("load",function(){document.body.addEventListener("click",_gaLt,!1)},!1) : w.attachEvent && w.attachEvent("onload",function(){document.body.attachEvent("onclick",_gaLt)});
</script>