Code:
function VisManager(){this.VisProcess=function(a){this.init=function(a){var b=0,c=null,d=null;this.id=a.id||0,this.callback=a.callback||function(a){},this.skipPost=a.skipPost||!1,this.delay=a.delay||500,this.trackingDuration=a.trackingDuration||Infinity,this.trackingInterval=a.trackingInterval||200,this.accountId=a.aid||null,this.foreignPlacementId=a.fpid||null,this.foreignCampaignId=a.fcid||null,this.host=a.host||"t4ft.de",this.placement=this.foreignPlacementId?"":a.placementId.replace("de",""),this.todo=this.foreignPlacementId?"vp":"v",this.url=a.url||window.location.protocol+"//"+this.host+"/"+this.todo+"/"+this.placement,this.method=a.method?a.method.toLowerCase():"get",this.domain=window.location.href,this.referrer=document.referrer,this.elements={},this.visibleTime={},this.trackedDuration=0,this.notFound={},this.started=!1,this.url||(this.skipPost=!0),this.onReady(function(){if(this.started)return;this.startUp(a),this.started=!0}.bind(this)),typeof window.onunload=="function"&&(c=window.onunload),window.onunload=function(){var a="";c&&c();for(a in this.visibleTime)this.visibleTime.hasOwnProperty(a)&&this.visibleTime[a]<1e3&&this.post(a)}.bind(this)},this.onReady=function(a){if(document.readyState==="complete")a();else if(document.addEventListener)window.addEventListener("load",a,!1);else{var b=!1;try{b=window.frameElement===null&&document.documentElement}catch(c){}if(b&&b.doScroll){var d=this;(function e(){if(!d.started){try{b.doScroll("left")}catch(c){return setTimeout(e,50)}a()}})()}else window.attachEvent("onload",a)}},this.startUp=function(a){if(this.started)return;setTimeout(function(){var b=0;this.elementsFound=0;for(b in a.elements)if(a.elements.hasOwnProperty(b)){var c=null;try{var d=Sizzle(a.elements[b]);/msie/i.test(window.navigator.userAgent)||d.length===1?c=d[0]:c=d[1]}catch(e){c=document.getElementById(a.elements[b])}c?(this.elements[b]=c,this.visibleTime[b]=0,this.elementsFound+=1):this.notFound[a.elements[b]]=!0}if(this.elementsFound<=0){this.post(-1);return}this.trackingProcess=setInterval(this.track.bind(this),this.trackingInterval)}.bind(this),this.delay)},this.track=function(){var a=0,b="";this.trackedDuration+=this.trackingInterval;var c=this.update(),d=[];for(b in c)if(c.hasOwnProperty(b)){c[b].p>=.5&&(this.visibleTime[b]+=this.trackingInterval);if(this.visibleTime[b]>=1e3){for(a in this.elements)this.elements.hasOwnProperty(a)&&a===b&&d.push(a);this.callback(b),this.post(b)}}for(a=0;a<d.length;a+=1)delete this.elements[d[a]];(this.trackedDuration>=this.trackingDuration||this.elements.length===0)&&clearInterval(this.trackingProcess)},this.update=function(){var a=0,b={w:window.innerWidth,h:window.innerHeight,x:window.pageXOffset,y:window.pageYOffset},c={};window.innerHeight===undefined&&(b={w:document.body.clientWidth,h:document.body.clientHeight,x:document.body.scrollLeft||document.body.scrollTop?document.body.scrollLeft:document.documentElement.scrollLeft,y:document.body.scrollLeft||document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop});for(a in this.elements)this.elements.hasOwnProperty(a)&&(c[a]=this.getVisibility(this.elements[a],b,a));return c},this.post=function(a){if(this.skipPost||window["ftgs_"+this.placement+"_blocked"])return;var b=["t="+Math.round(Date.now()/1e3),"l="+encodeURIComponent(this.domain),"r="+encodeURIComponent(this.referrer),"e="+a,"f="+(window.top!==window.self?1:0),"v="+(this.elementsFound>0?this.visibleTime[a]<1e3?0:window.top!==window.self?2:1:-1)];this.foreignPlacementId&&(b=b.concat(["fpid="+encodeURIComponent(this.foreignPlacementId),"fcid="+encodeURIComponent(this.foreignCampaignId),"aid="+this.accountId])),b=b.join("&");if(this.method==="post"){var c=new XMLHttpRequest;c.open("post",this.url,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(b)}else{var d=new Image(1,1);d.src=this.url+"?"+b}},this.getWidthOrHeight=function(a,b){var c=document.createElement("div");c.innerHTML="",c.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";var d=c.offsetWidth===4,e=document.getElementsByTagName("body")[0].offsetTop!==1,f=b==="width"?a.offsetWidth:a.offsetHeight,g=!0,h=d&&a.style.boxSizing==="border-box";if(f<=0||f===null){f=a.style[b];if(/^([\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|))(?!px)[a-z%]+$/i.test(f))return f;g=h&&f===a.style[b],f=parseFloat(f)||0}return f},this.getVisibility=function(a,b,c){var d=a.ownerDocument,e=d.documentElement,f=a.getBoundingClientRect(),g=e.clientTop||d.body.clientTop||0,h=e.clientLeft||d.body.clientLeft||0,i=window.pageYOffset||e.scrollTop,j=window.pageXOffset||e.scrollLeft,k={x:f.left+j-h,y:f.top+i-g,w:this.getWidthOrHeight(a,"width"),h:this.getWidthOrHeight(a,"height")},l={w:k.w+(Math.min(0,k.x-b.x)+Math.min(0,b.x+b.w-(k.x+k.w))),h:k.h+(Math.min(0,k.y-b.y)+Math.min(0,b.y+b.h-(k.y+k.h)))};return l.p=Math.max(0,l.w*l.h/(k.w*k.h)),l},this.init(a)},this.getScriptElement=function(a){var b=document.getElementsByTagName("script"),c=0;for(c=0;b[c];c+=1)if(b[c].id===a&&!b[c].getAttribute("ftgv"))return b[c]},this.parseData=function(a){var b,c=/\+/g,d=/([^&=]+)=?([^&]*)/g,e=function(a){return decodeURIComponent(a.replace(c," "))},f={};while(b=d.exec(a))f[e(b[1])]=e(b[2]);return f},this.processes={},this.init=function(a){a.id=Math.round(Math.random()*16777215),this.processes[a.id]=new this.VisProcess(a)}}Function.prototype.bind||(Function.prototype.bind=function(a){if(typeof this!="function")return;var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),window.ftgVis||(window.ftgVis=new VisManager);var script=window.ftgVis.getScriptElement("t4ftvis");if(script){script.setAttribute("ftgv","1");var data=window.ftgVis.parseData(script.getAttribute("data"));window.ftgVis.init({aid:data.aid,fpid:data.fpid,fcid:data.fcid,elements:{1:data.element}})};