var mtr_obj=mtr_obj||function(){function t(){function o(n,t,i){n.addEventListener?n.addEventListener(t,i,!1):n.attachEvent("on"+t,function(){return i.call(n,window.event)})}function e(n,t){if(document.createEvent){var i=document.createEvent("Events");i.detail=t;i.initEvent(n,!0,!0);document.dispatchEvent(i)}}e("onBeforeInitializedTracker");var n=this,t=[],r=[],i=0,u=!1,f="t.myvisitors.se";this.domain="http://"+f;document.location.protocol==="https:"&&(this.domain="https://"+f,this.secure=1);this.init=function(i){n.initiatePerson();n.initiateVisit();t.push(i);n.setup_site_id(i);n.initClearUserData();e("onAfterInitializedTracker")};this.setup_site_id=function(t){is_first_page_view=!n.get_cookie("fpv_"+t);n.set_cookie("fpv_"+t,1,1200);mtr_custom.async?setTimeout(n.add_event_to_links,1e3):this.add_event(window,"load",n.add_event_to_links);(is_first_page_view||mtr_custom.disable_cookies)&&n.set_referrer(document.referrer);mtr_custom.disable_pageview&&(!is_first_page_view||mtr_custom.disable_cookies)?n.get_cookie("ping_once_"+t)&&n.ok():n.log_pageview();var i=mtr_custom.disable_pageview&&mtr_custom.disable_ping&&is_first_page_view&&!mtr_custom.disable_cookies;i&&n.set_cookie("ping_once_"+t,1,1200);n.addPageviewToVisit(location.pathname)};this.log_pageview=function(i){var f=n.get_href(),u;for(n.log_data("","&href="+n.encode(f)+"&title="+n.encode(mtr_custom.title||document.title)+"&ref="+(n.ref||"")+(i||""),1),u=0;u<t.length;u++)n.is_pageview_fired(t[u])||r.push(t[u])};this.log_data=function(i,r,u,f){var c,a,o,h,e,s,l;if(r=r||"",i=i||"pageview",typeof r=="object")if(r.type&&(i=r.type),r.type=="goal"&&r.query)r=r.query;else{c="";for(e in r)e!="type"&&r.hasOwnProperty&&r.hasOwnProperty(e)&&(a=n.encode(r[e]),a&&(c+="&"+e+"="+n.encode(r[e])));r=c;delete c}if(o="",h="",o=n.get_cookie("_mtruid"),o||(n.set_cookie("_mtruid",n.rand()),o=n.get_cookie("_mtruid")),i!="ping"&&mtr_custom.goal){if(typeof mtr_custom.goal=="object")for(e in mtr_custom.goal)mtr_custom.goal.hasOwnProperty&&mtr_custom.goal.hasOwnProperty(e)&&(n.addGoal(n.encode(mtr_custom.goal[e])),h+="&goal["+n.encode(e)+"]="+n.encode(mtr_custom.goal[e]));else n.addGoal(n.encode(mtr_custom.goal)),h="&goal="+n.encode(mtr_custom.goal);mtr_custom.goal=""}for(s=0;s<t.length;s++)(l=t[s],n.get_cookie("dont_track_"+l))||u&&i=="pageview"&&n.is_pageview_fired(l)||(mtr_custom.onlydev||n.inject(n.base_url(n.domain,s,i)+"&type="+i+r+h+(o?"&jsuid="+o:"")+(mtr_custom.disable_cookies?"&noc=1":"")+"&mime=js&x="+Math.random()+"",undefined,f),mtr_custom.devdomain&&n.inject(n.base_url(mtr_custom.devdomain,s,i)+"&type="+i+r+h+(o?"&jsuid="+o:"")+(mtr_custom.disable_cookies?"&noc=1":"")+"&mime=js&x="+Math.random()+"",undefined,f),(i=="outbound"||i=="download")&&n.pause());n.ref=""};this.inject=function(n,t,i){var r,u;t=t||"js";t=="js"?(r=document.createElement("script"),r.type="text/javascript",r.async=!0,r.src=n):t=="css"&&(r=document.createElement("link"),r.type="text/css",r.rel="stylesheet",r.href=n);i&&(typeof i!="object"&&(i.func=i),u=!1,setTimeout(function(){u||(u=!0,i.func(i.params))},i.timeout||3e3),o(r,"load",function(){u||(u=!0,i.func(i.params))}));(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(r)};this.pause=function(n){for(var t=new Date,i=t.getTime()+(n||mtr_custom.timer||500);t.getTime()<i;)t=new Date};this.download=function(t){n.event_log(t,"download")};this.outbound=function(t){n.event_log(t,"outbound")};this.click=function(t){n.event_log(t,"click")};this.event_log=function(t,i){var r=n.get_target(t);n.log(n.get_adv_href(r),n.get_adv_text(r),i)};this.add_event=function(n,t,i){n.addEventListener?n.addEventListener(t,i,!1):n.attachEvent&&n.attachEvent("on"+t,i)};this.add_event_to_links=function(){var t,r,u;if(!mtr_custom.disable_advanced){var f=new RegExp("^(https?|ftp|telnet|mailto):","i"),e=new RegExp("^https?://(.*)"+location.host.replace(/^www\./i,""),"i"),o=new RegExp("\\.(7z|aac|avi|cab|csv|dmg|doc(x|m|b)?|epub|exe|flv|gif|gz|jpe?g|js|m4a|mp(3|4|e?g)|mobi|mov|msi|pdf|phps|png|ppt(x|m|b)?|rar|rtf|sea|sit|tar|torrent|txt|wma|wmv|xls(x|m|b)?|xml|zip|svg)$","i"),i=document.getElementsByTagName("a");for(t=0;t<i.length;t++)if(i[t].className.match(/mtr_log/i))i[t].className.match(/mtr_log_download/i)?n.add_event(i[t],"mousedown",n.download):i[t].className.match(/mtr_log_outbound/i)?n.add_event(i[t],"mousedown",n.outbound):n.add_event(i[t],"mousedown",n.click);else if(f.test(i[t].href)&&!i[t].className.match(/mtr_ignore/i))if(o.test(i[t].href))n.add_event(i[t],"mousedown",n.download);else if(e.test(i[t].href)){if(mtr_custom.outbound_pattern)if(r=mtr_custom.outbound_pattern,typeof r=="object"){for(u=0;u<r.length;u++)if(n.outbound_pattern_match(i[t].href,r[u])){n.add_event(i[t],"mousedown",n.outbound);break}}else typeof r=="string"&&n.outbound_pattern_match(i[t].href,r)&&n.add_event(i[t],"mousedown",n.outbound)}else n.add_event(i[t],"mousedown",n.outbound)}};this.log=function(t,i,r,u){r=="pageview"&&(t=t.replace(/^https?:\/\/([^\/]+)/i,""));var f={type:r||"click",href:t,title:i||""};n.log_data(r,f,undefined,u)};this.event=function(t,i){n.log(null,t,"event",i)};this.widget=function(t,i,r){n.log(null,i,"widget-"+t,r)};this.video=function(t,i,r,u,f,e){return!r||!t?!1:(n.log_data("video","&video[action]="+t+"&video[time]="+(i||0)+"&href="+n.encode(r)+(u?"&title="+n.encode(u):"")+(f?"&video[duration]="+f:""),undefined,e),!0)};this.goal=function(t,i,r){if(t){n.addGoal(t);var u=typeof t=="number"||t.match(/^[0-9]+$/)?"[id]="+t:"[name]="+n.encode(t);u={type:"goal",query:"&goal"+u+(i?"&goal[revenue]="+i:"")+"&title="+n.encode(t)};n.log_data("goal",u,undefined,r)}};this.ping=function(){n.log_data("ping");u=!1};this.ok=function(){var o=mtr_custom.fast_ping?90:11,f,e,r;if(!(i>o)&&!u){if(mtr_custom.disable_pageview&&mtr_custom.disable_ping){for(f=0;f<t.length;f++)e=t[f],n.get_cookie("ping_once_"+e)&&(i=o+1,setTimeout(function(){n.set_cookie("ping_once_"+e,undefined,-1);n.ping()},1e4));return}r=5e3;mtr_custom.fast_ping?i>0&&(r=1e4):i>4?r=12e4:i>2?r=3e4:i>1?r=2e4:i>0&&(r=1e4);setTimeout(n.ping,r);u=!0;i++}};this.get_cookie=function(n){for(var i=document.cookie.split(";"),t=0,r=i.length;t<r;t++)if(i[t].match(new RegExp("\\b"+n+"=")))return decodeURIComponent(i[t].split(n+"=")[1]);return""};this.set_cookie=function(n,t,i){if(mtr_custom.disable_cookies)return!1;var r=new Date;r.setTime(r.getTime()+(i||31536e4)*1e3);document.cookie=n+"="+t+";expires="+r.toGMTString()+";path=/;domain="+(mtr_custom.cookie_domain||"."+location.hostname.replace(/^www\./i,""))+";"};this.base_url=function(i,r,u){var f=i+"/t?site_id="+t[r],c,o,s,h,e;if(u=="ping")return f;f+="&res="+screen.width+"x"+screen.height+"&lang="+(navigator.language||navigator.browserLanguage||"en").substr(0,2)+(n.secure?"&secure=1":"");try{for(c=["email","firstname","lastname","name","organization","telephone"],o=0;o<c.length;o++)s=c[o],h=n.get_cookie("utm_custom_"+s),h&&h!=null&&f.indexOf("custom["+s+"]=")==-1&&(f+="&custom["+s+"]="+n.encode(h))}catch(l){}if(mtr_custom.session)for(e in mtr_custom.session)mtr_custom.session.hasOwnProperty&&mtr_custom.session.hasOwnProperty(e)&&f.indexOf("custom["+n.encode(e)+"]=")==-1&&(f+="&custom["+n.encode(e)+"]="+n.encode(mtr_custom.session[e]));return f};this.set_referrer=function(t){n.ref=t?RegExp("^https?://[^/]*"+location.host.replace(/^www\./i,"")+"/","i").test(t)?"":this.encode(t):""};this.get_adv_text=function(t){do{var i=t.text?t.text:t.innerText;if(i)return i;if(t.alt)return t.alt;if(t.title)return t.title;if(t.src)return t.src;t=n.get_parent(t)}while(t);return""};this.get_adv_href=function(t){do{if(t.href&&!t.src)return t.href;t=n.get_parent(t)}while(t);return""};this.get_href=function(t){var i=mtr_custom.href||"";return i||(mtr_custom.iframe&&self!=top?(n.set_referrer(top.document.referrer),i=top.location.pathname+top.location.search,mtr_custom.title||(mtr_custom.title=top.document.title)):i=location.hash.match(/utm_/i)?location.pathname+(location.search?location.search+"&":"?")+location.hash.substr(1):location.pathname+location.search),t?n.encode(i):i};this.get_target=function(n){n||(n=window.event);var t=n.target?n.target:n.srcElement;return t.nodeType&&t.nodeType==3&&(t=t.parentNode),t};this.is_pageview_fired=function(n){for(var t=0;t<r.length;t++)if(r[t]==n)return!0;return!1};this.get_parent=function(n){return n.parentElement||n.parentNode};this.encode=function(n){return window.encodeURIComponent?encodeURIComponent(n):escape(n)};this.outbound_pattern_match=function(n,t){return RegExp(t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")).test(n)};this.rand=function(){return Math.round(Math.random()*4294967295)};this.initiatePerson=function(){var t=n.getPerson();t||(t={labels:[],goals:[]},n.setPerson(t))};this.setPerson=function(t){typeof Storage!="undefined"&&localStorage.setItem("mtr_p",n.obfuscate(JSON.stringify(t)))};this.getPerson=function(){if(typeof Storage!="undefined"){var t=localStorage.getItem("mtr_p");return t&&JSON.parse(n.deobfuscate(t))}return null};this.addLabel=function(t){var i=n.getPerson();i.labels.indexOf(t)===-1&&(i.labels.push(t),n.setPerson(i))};this.addGoal=function(t){var r=n.getPerson(),i;r.goals.indexOf(t)===-1&&(r.goals.push(t),n.setPerson(r));i=n.getVisit();i.goals.indexOf(t)===-1&&(i.goals.push(t),n.setVisit(i));n.set_cookie("mtr_goal-"+t,1,420)};this.initiateVisit=function(){var t=n.getVisit(),i;t||(i=location.search.replace("?","").split("&"),t={landingPageQueryParams:i,goals:[]},n.setVisit(t))};this.setVisit=function(t){typeof Storage!="undefined"&&sessionStorage.setItem("mtr_v",n.obfuscate(JSON.stringify(t)))};this.getVisit=function(){if(typeof Storage!="undefined"){var t=sessionStorage.getItem("mtr_v");return t&&JSON.parse(n.deobfuscate(t))}return null};this.addPageviewToVisit=function(t){var i=n.getVisit();i.pageviews=i.pageviews||[];i.pageviews.push(t);n.setVisit(i)};this.obfuscate=function(n){for(var t,r=[],i=0;i<n.length;i++)t=n.charCodeAt(i),t=String("000"+t).slice(-3),r.push(t);return r.join("")};this.deobfuscate=function(n){for(var i="",r=n.match(/.{1,3}/g),t=0;t<r.length;t++)i+=String.fromCharCode(parseInt(r[t],10));return i};this.getQueryStringValue=function(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t==null?"":decodeURIComponent(t[1].replace(/\+/g," "))};this.clearUserData=function(){for(var u=document.cookie.split(";"),i=0;i<u.length;i++){var r=u[i].trim(),f=r.indexOf("="),t=f>-1?r.substr(0,f):r;(t.substr(0,4)==="mtr-"||t.substr(0,4)==="mtr_"||t.substr(0,7)==="_mtruid"||t.substr(0,4)==="fpv_")&&n.set_cookie(t,undefined,-1)}typeof Storage!="undefined"&&(localStorage.removeItem("mtr_p"),sessionStorage.removeItem("mtr_v"));console.log("User data cleared")};this.initClearUserData=function(){location.search.indexOf("clear-tb=")!==-1&&n.clearUserData()}}var n=null;return new function(){this.getInstance=function(){return n==null&&(n=new t,n.constructor=null),n};this.clearInstance=function(){n=null}}}(),mtr=mtr_obj.getInstance(),mtr_site_ids;if(window.mtr_site_id&&(mtr_site_ids=mtr_site_ids||[],mtr_site_ids.push(mtr_site_id)),window.mtr_site_ids)for(mtr_custom.async=1;mtr_site_ids.length;)mtr.init(mtr_site_ids.shift());
//# sourceMappingURL=mytracker.min.js.map