/** * Track file downloads */ var downloadExtension = ['doc','docx','pdf','xls','ppt','zip','gz','bz2','rar','txt','vsd','vxd','js','css','exe','wma','mov','avi','wmv','mp3','mp4']; var trackDownloadsAsEvent = true; var trackExtlinksAsEvent = true; var downloadCat = 'Downloads'; var extLinksCat = 'Externe Links'; var intDomain = window.location.hostname; document.addEventListener('DOMContentLoaded', function(){ if (window.addEventListener) { document.addEventListener('click', clickHandler, false); } else { document.attachEvent('onclick', clickHandler); } }); function clickHandler(e) { if (window.event) e = window.event; var srcEl = e.srcElement ? e.srcElement : e.target; var srcElName = srcEl.tagName.toLowerCase(); var targetUrl = srcEl.getAttribute('href'); if (srcElName == 'img') { targetUrl = srcEl.parentNode.getAttribute('href'); } if (targetUrl && targetUrl.length > 0) { var re = new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)', 'im'); var tarDomain = (targetUrl.match(re)? targetUrl.match(re)[1].toString() : (targetUrl.indexOf(':') < 0 ? intDomain : null)); if (tarDomain != null) { var a = document.createElement('a'); a.href = targetUrl; var filePath = a.pathname; var fileName = filePath.split('/').pop(); var fileExt = fileName.substring(fileName.indexOf('.')+1); if (intDomain == tarDomain) { for (i=0; i