google.load("visualization","1",{packages:["corechart"]});(function(){var a=jQuery;var b=false;var c=function(h,e,k,l,f){var h=h,e=e,k=k,d=l,n=0,j=0,m=Date.parse(f)-Date.parse(new Date());function g(o){if(b){return true}if(typeof(o.error)!="undefined"&&o.error!=""){b=true;a("#content4stats").html('

'+(o.error)+"

Please check your project settings.

");return true}return false}addCommas=function(p){p+="";x=p.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";var o=/(\d+)(\d{3})/;while(o.test(x1)){x1=x1.replace(o,"$1,$2")}return x1+x2};getBrowserIconClass=function(o){if(typeof(o)=="undefined"||o===null||(typeof(o)!="object"&&typeof(o)!="string")){return""}return"browser-logo browser-"+o.toLowerCase().replace(/\s[0-9\.]+$/,"").replace(/\s/g,"-")};getOsIconClass=function(p){if(typeof(p)=="undefined"||p===null||(typeof(p)!="object"&&typeof(p)!="string")){return""}if(p.search(/^windows/i)!=-1){var o="windows"}else{if(p.search(/^macintosh/i)!=-1||p.search(/^mac os/i)!=-1){var o="macintosh" }else{if(p.search(/^ios/i)!=-1){var o="ios"}else{if(p.search(/^linux/i)!=-1){var o="linux"}else{if(p.search(/^android/i)!=-1){var o="android"}else{var o=""}}}}}return"os-logo os-"+o.toLowerCase().replace(/\s[0-9\.]+$/,"").replace(/\s/g,"-")};parseUri=function(o){var p=document.createElement("a");p.href=(o.match(/^https?:\/\//i)!==null)?o:("http://"+o);return p};showFSDayPerfGraph=function(){var p=new Date();p.setTime(Date.parse(new Date())+m);var o=p.getDate();var r=p.getMonth()+1;var q=p.getFullYear();a.getJSON("https://www.4stats.de/api/numbers?pid="+h+"&token="+e+"&apikey="+k+"&mon="+r+"-"+q+"&day="+o+"&jsoncallback=?",function(u){if(g(u.results)){return}chart_data=new Array(["Hour","Page views","Visits"]);for(i=0;i"+q+"";a("#fs_dashboard_stats").append(p)})})};showFSDashboard=function(){a.getJSON("https://www.4stats.de/api/dashboard?pid="+h+"&token="+e+"&apikey="+k+"&jsoncallback=?",function(r){if(g(r.results)){return}var s=["Visits","Returning Visitors","New Visits","Page views","Ø Pages/Visit","Ø Time on Site (Min.)"];var q={Today:"today",Yesterday:"yesterday","This month":"thismonth","Last month":"lastmonth","This year":"thisyear",Total:"total"};var p={};a.each(q,function(t,u){p[t]=[r.results["visits_"+u],r.results["ret_visits_"+u],r.results["visits_"+u]-r.results["ret_visits_"+u],r.results["hits_"+u],r.results["hits_per_visit_"+u],r.results["avg_time_"+u]] });a("#fs_overview_stats thead tr").append("");a.each(s,function(t,u){a("#fs_overview_stats thead tr").append(""+u+"")});a.each(p,function(v,u){var t=''+v+"";a.each(u,function(w,y){if(!isNaN(y)){y=addCommas(y)}t+=''+y+""});t+="";a("#fs_overview_stats tbody").append(t)});if(r.results.visits_ythr.results.visits_today){var o="bad"}else{var o="noc"}}a("#fs_overview_stats tbody tr").first().children("td").eq(1).prepend(''+r.results.visits_yth_percent+"%");if(r.results.hits_ythr.results.hits_today){var o="bad"}else{var o="noc"}}a("#fs_overview_stats tbody tr").first().children("td").eq(4).prepend(''+r.results.hits_yth_percent+"%");a("#fs_overview_stats thead tr").first().children("th").first().html(""+r.results.user_online+" Online") })};showFSGraphs=function(){showFSDayPerfGraph();var q=new Date();q.setTime(Date.parse(new Date())+m);q.setMonth(q.getMonth()-1);var o=q.getDate();var r=q.getMonth()+1;var v=q.getFullYear();var q=new Date();q.setTime(Date.parse(new Date())+m);var p=q.getDate();var u=q.getMonth()+1;var t=q.getFullYear();a.getJSON("https://www.4stats.de/api/numbers?pid="+h+"&token="+e+"&apikey="+k+"&from="+v+"-"+r+"-"+o+"&to="+t+"-"+u+"-"+p+"&jsoncallback=?",function(z){if(g(z.results)){return}chart_data=new Array(["Hour","Page views","Visits"]);for(i=0;i";for(i=0;i";if(i>=9){break}}html+="
'+p+""+q+"
'+stat.count+""+stat.name+"
";a("#fs-box-row").append(html).fadeIn(300)})};showFSVisitorLog=function(){a.getJSON("https://www.4stats.de/api/visitor_log?pid="+h+"&token="+e+"&apikey="+k+"&jsoncallback=?",function(q){if(g(q.results)){return}for(i=0;i"+stat.hits+" Page"+((stat.hits>1)?"s":"")+"";o+=""+stat.ip+"("+stat.host+")
";o+=' '+stat.os+' '+stat.browser+"
"; o+="Screen: "+stat.screen+" - GEO: "+stat.geo+"";o+="";if(stat.referrer!=""){var p=parseUri(stat.referrer);o+=''+p.hostname+""}o+="
"+stat.entry+"
";if(stat.kw!=""){o+="Keyword: "+stat.kw+""}o+="";a("#fs-visitor-log tbody").append(o).fadeIn(300);if(i>=25){break}}})};return{statsPage:function(){showFSGraphs();showFSDashboard();showFSBoxStats("sites","Site","Views");window.setTimeout("showFSBoxStats('keywords', 'Keywords', 'Visits')",500);window.setTimeout("showFSBoxStats('referrer', 'Referrer', 'Visits')",1000);window.setTimeout("showFSBoxStats('browser', 'Browser', 'Visits')",1500);window.setTimeout("showFSBoxStats('os', 'OS', 'Visits')",2000);window.setTimeout("showFSBoxStats('screen', 'Screen', 'Visits')",2500);showFSVisitorLog()},dashBoard:function(){showFSWPDashboard()},}};window.fourStats=c})();