diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2011-02-14 06:42:40 +0300 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2011-02-14 06:42:40 +0300 |
commit | 5e4096980cbc6f725b02953b87c4ecf697fc7a97 (patch) | |
tree | 13dbb8e274f4407baebbb23ae7cbb40601180e6a /piwik.js | |
parent | 087471e07fd4964b177004a2e5ffe89335543de2 (diff) |
Refs #409 Disabling getVisitorId() for now as it doesn't work when called before track* (the object should init the uuid member before getRequest())
Would be nice to have though, to make it trivial to get the visitorId from piwik into other systems (Salesforce, Form fill), and then also allow querying the Live! API to fetch data about this visitor.
git-svn-id: http://dev.piwik.org/svn/trunk@3893 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'piwik.js')
-rw-r--r-- | piwik.js | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -18,7 +18,7 @@ function aK(aT){var aS;if(ak){aS=new RegExp("#.*");return aT.replace(aS,"")}retu }if(j.mimeTypes&&j.mimeTypes.length){for(aS in W){aT=j.mimeTypes[W[aS][1]];if(aT&&aT.enabledPlugin){W[aS][2]="1"}}}}function N(aS){return aD+aS+"."+av}function au(){var aS=N("testcookie");if(!b(j.cookieEnabled)){s(aS,"1");return E(aS)==="1"?"1":"0"}return j.cookieEnabled?"1":"0"}function ai(){av=aI((P||Z)+(ax||"/")).slice(0,8)}function X(){var aT=N("cvar"),aS=E(aT);if(aS.length){aS=JSON.parse(aS);if(n(aS)){return aS}}return{}}function aE(){if(aG===false){aG=X()}}function O(aS){var aT=new Date();aa=aT.getTime()}function am(bf){var bc,aS=new Date(),a1=Math.round(aS.getTime()/1000),aV=1024,aU,be,bg,bd,aW,a8,ba,a0,aZ,bb,bh,a4,aY,a6=N("id"),a2=N("ses"),a3=N("ref"),bi=N("cvar"),a9=E(a6),a5=E(a2),aX=E(a3),a7=d.location.protocol==="https",aT="&res="+v.width+"x"+v.height+"&cookie="+Q;if(L){s(a6,"",-1,ax,P);s(a2,"",-1,ax,P);s(bi,"",-1,ax,P);s(a3,"",-1,ax,P);return""}for(bc in W){aT+="&"+W[bc][0]+"="+W[bc][2]}if(a9){bg="0";aU=a9.split(".");bd=aU[0];a8=aU[1];aW=aU[2];ba=aU[3];a0=aU[4]}else{bg="1";a8=a1; ba=a1;a0="";bd=aI((j.userAgent||"")+(j.platform||"")+aT+Math.round(aS.getTime/1000)).slice(0,16);aW=0}az=bd;if(aX){be=aX.indexOf(".");aZ=aX.slice(0,be);bb=aX.slice(be+1)}else{aZ=0;bb=""}if(!a5){aW++;a0=ba;bh=y(aA);a4=aX?y(aX):"";if(bh.length&&!ap(bh)&&(!ar||!a4.length||ap(a4))){aZ=a1;bb=aA;s(a3,aZ+"."+bb.substr(0,aV),ab,ax,P,a7)}}aY=JSON.stringify(aG);aT="idsite="+aQ+"&rec=1&rand="+Math.random()+"&h="+aS.getHours()+"&m="+aS.getMinutes()+"&s="+aS.getSeconds()+"&url="+e(aK(aJ||V))+"&urlref="+e(aK(aA))+"&_id="+bd+"&_idts="+a8+"&_idvc="+aW+"&_idn="+bg+"&_ref="+e(aK(bb.substr(0,aV)))+"&_refts="+aZ+"&_viewts="+a0+aT;if(aY.length>10){aT+="&_cvar="+aY}for(cvarId in aG){if(aG[cvarId][0]==""||aG[cvarId][1]==""){delete aG[cvarId]}}aY=JSON.stringify(aG);s(bi,aY,af,ax,P,a7);ba=a1;s(a6,bd+"."+a8+"."+aW+"."+ba+"."+a0,aR,ax,P,a7);s(a2,"*",af,ax,P,a7);aT+=g(bf);return aT}function I(aV){var aS=new Date(),aU=am("log")+"&action_name="+e(aV||aP);aM(aU,ac);if(J&&aj&&!S){S=true;t(d,"click",O);t(d,"mouseup",O); t(d,"mousedown",O);t(d,"mousemove",O);t(d,"mousewheel",O);t(G,"DOMMouseScroll",O);t(G,"scroll",O);t(d,"keypress",O);t(d,"keydown",O);t(d,"keyup",O);t(G,"resize",O);t(G,"focus",O);t(G,"blur",O);aa=aS.getTime();setTimeout(function aT(){var aW=new Date(),aX;if((aa+aj)>aW.getTime()){if(J<aW.getTime()){aX=am("ping")+"&ping=1";aM(aX,ac)}setTimeout(aT,aj)}},aj)}}function aL(aS,aU){var aT=am("goal")+"&idgoal="+aS;if(aU){aT+="&revenue="+aU}aM(aT,ac)}function ag(aT,aS){var aU=am("click")+"&"+aS+"="+e(aK(aT));aM(aU,ac)}function at(aU,aT){var aV,aS="(^| )(piwik[_-]"+aT;if(aU){for(aV=0;aV<aU.length;aV++){aS+="|"+aU[aV]}}aS+=")( |$)";return new RegExp(aS)}function aO(aV,aS,aW){if(!aW){return"link"}var aU=at(aC,"download"),aT=at(aF,"link"),aX=new RegExp("\\.("+ah+")([?&#]|$)","i");return aT.test(aV)?"link":(aU.test(aV)||aX.test(aS)?"download":0)}function U(aX){var aV,aT,aS;while(!!(aV=aX.parentNode)&&((aT=aX.tagName)!=="A"&&aT!=="AREA")){aX=aV}if(b(aX.href)){var aY=aX.hostname||y(aX.href),aZ=aY.toLowerCase(),aU=aX.href.replace(aY,aZ),aW=new RegExp("^(javascript|vbscript|jscript|mocha|livescript|ecmascript): *","i"); -if(!aW.test(aU)){aS=aO(aX.className,aU,ap(aZ));if(aS){ag(aU,aS)}}}}function ae(aS){var aT,aU;aS=aS||G.event;aT=aS.which||aS.button;aU=aS.target||aS.srcElement;if(aS.type==="click"){if(aU){U(aU)}}else{if(aS.type==="mousedown"){if((aT===1||aT===2)&&aU){aN=aT;ao=aU}else{aN=ao=null}}else{if(aS.type==="mouseup"){if(aT===aN&&aU===ao){U(aU)}aN=ao=null}}}}function aH(aT,aS){if(aS){t(aT,"mouseup",ae,false);t(aT,"mousedown",ae,false)}else{t(aT,"click",ae,false)}}function an(aT){if(!aq){aq=true;var aU,aS=at(M,"ignore"),aV=d.links;if(aV){for(aU=0;aU<aV.length;aU++){if(!aS.test(aV[aU].className)){aH(aV[aU],aT)}}}}}Q=au();R();ai();return{getVisitorId:function(){return az},setTrackerUrl:function(aS){ad=aS},setSiteId:function(aS){aQ=aS},setCustomVariable:function(aT,aS,aU){aE();if(aT>0&&aT<=5){aG[aT]=[aS.slice(0,T),aU.slice(0,T)]}},getCustomVariable:function(aS){aE();return aG[aS]},deleteCustomVariable:function(aS){var aT=this.getCustomVariable(aS);if(b(aT)){this.setCustomVariable(aS,"","")}},setLinkTrackingTimer:function(aS){ac=aS -},setDownloadExtensions:function(aS){ah=aS},addDownloadExtensions:function(aS){ah+="|"+aS},setDomains:function(aS){aB=q(aS)?[aS]:aS;aB.push(Z)},setIgnoreClasses:function(aS){M=q(aS)?[aS]:aS},setRequestMethod:function(aS){K=aS||"GET"},setReferrerUrl:function(aS){aA=aS},setCustomUrl:function(aS){aJ=aS},setDocumentTitle:function(aS){aP=aS},setDownloadClasses:function(aS){aC=q(aS)?[aS]:aS},setLinkClasses:function(aS){aF=q(aS)?[aS]:aS},discardHashTag:function(aS){ak=aS},setCookieNamePrefix:function(aS){aD=aS;aG=X()},setCookieDomain:function(aS){P=l(aS);ai()},setCookiePath:function(aS){ax=aS;ai()},setVisitorCookieTimeout:function(aS){aR=aS*1000},setSessionCookieTimeout:function(aS){af=aS*1000},setReferralCookieTimeout:function(aS){ab=aS*1000},setConversionAttributionFirstReferrer:function(aS){ar=aS},setDoNotTrack:function(aS){L=aS&&j.doNotTrack},addListener:function(aT,aS){aH(aT,aS)},enableLinkTracking:function(aS){if(h){an(aS)}else{B[B.length]=function(){an(aS)}}},setHeartBeatTimer:function(aU,aT){var aS=new Date(); -J=aS.getTime()+aU*1000;aj=aT*1000},killFrame:function(){if(G!==G.top){G.top.location=G.location}},redirectFile:function(aS){if(G.location.protocol==="file:"){G.location=aS}},trackGoal:function(aS,aT){aL(aS,aT)},trackLink:function(aT,aS){ag(aT,aS)},trackPageView:function(aS){I(aS)}}}function c(){return{push:z}}t(G,"beforeunload",A,false);x();F=new D();for(C=0;C<_paq.length;C++){z(_paq[C])}_paq=new c();return{addPlugin:function(i,I){w[i]=I},getTracker:function(i,I){return new D(i,I)},getAsyncTracker:function(){return F}}}()),piwik_track,piwik_log=function(b,f,d,g){function a(h){try{return eval("piwik_"+h)}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);if(!!(c=a("tracker_pause"))){e.setLinkTrackingTimer(c)}if(!!(c=a("download_extensions"))){e.setDownloadExtensions(c)}if(!!(c=a("hosts_alias"))){e.setDomains(c)}if(!!(c=a("ignore_classes"))){e.setIgnoreClasses(c)}e.trackPageView();if((a("install_tracker"))){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j); -e.trackLink(i,h)};e.enableLinkTracking()}};
\ No newline at end of file +if(!aW.test(aU)){aS=aO(aX.className,aU,ap(aZ));if(aS){ag(aU,aS)}}}}function ae(aS){var aT,aU;aS=aS||G.event;aT=aS.which||aS.button;aU=aS.target||aS.srcElement;if(aS.type==="click"){if(aU){U(aU)}}else{if(aS.type==="mousedown"){if((aT===1||aT===2)&&aU){aN=aT;ao=aU}else{aN=ao=null}}else{if(aS.type==="mouseup"){if(aT===aN&&aU===ao){U(aU)}aN=ao=null}}}}function aH(aT,aS){if(aS){t(aT,"mouseup",ae,false);t(aT,"mousedown",ae,false)}else{t(aT,"click",ae,false)}}function an(aT){if(!aq){aq=true;var aU,aS=at(M,"ignore"),aV=d.links;if(aV){for(aU=0;aU<aV.length;aU++){if(!aS.test(aV[aU].className)){aH(aV[aU],aT)}}}}}Q=au();R();ai();return{setTrackerUrl:function(aS){ad=aS},setSiteId:function(aS){aQ=aS},setCustomVariable:function(aT,aS,aU){aE();if(aT>0&&aT<=5){aG[aT]=[aS.slice(0,T),aU.slice(0,T)]}},getCustomVariable:function(aS){aE();return aG[aS]},deleteCustomVariable:function(aS){var aT=this.getCustomVariable(aS);if(b(aT)){this.setCustomVariable(aS,"","")}},setLinkTrackingTimer:function(aS){ac=aS},setDownloadExtensions:function(aS){ah=aS +},addDownloadExtensions:function(aS){ah+="|"+aS},setDomains:function(aS){aB=q(aS)?[aS]:aS;aB.push(Z)},setIgnoreClasses:function(aS){M=q(aS)?[aS]:aS},setRequestMethod:function(aS){K=aS||"GET"},setReferrerUrl:function(aS){aA=aS},setCustomUrl:function(aS){aJ=aS},setDocumentTitle:function(aS){aP=aS},setDownloadClasses:function(aS){aC=q(aS)?[aS]:aS},setLinkClasses:function(aS){aF=q(aS)?[aS]:aS},discardHashTag:function(aS){ak=aS},setCookieNamePrefix:function(aS){aD=aS;aG=X()},setCookieDomain:function(aS){P=l(aS);ai()},setCookiePath:function(aS){ax=aS;ai()},setVisitorCookieTimeout:function(aS){aR=aS*1000},setSessionCookieTimeout:function(aS){af=aS*1000},setReferralCookieTimeout:function(aS){ab=aS*1000},setConversionAttributionFirstReferrer:function(aS){ar=aS},setDoNotTrack:function(aS){L=aS&&j.doNotTrack},addListener:function(aT,aS){aH(aT,aS)},enableLinkTracking:function(aS){if(h){an(aS)}else{B[B.length]=function(){an(aS)}}},setHeartBeatTimer:function(aU,aT){var aS=new Date();J=aS.getTime()+aU*1000; +aj=aT*1000},killFrame:function(){if(G!==G.top){G.top.location=G.location}},redirectFile:function(aS){if(G.location.protocol==="file:"){G.location=aS}},trackGoal:function(aS,aT){aL(aS,aT)},trackLink:function(aT,aS){ag(aT,aS)},trackPageView:function(aS){I(aS)}}}function c(){return{push:z}}t(G,"beforeunload",A,false);x();F=new D();for(C=0;C<_paq.length;C++){z(_paq[C])}_paq=new c();return{addPlugin:function(i,I){w[i]=I},getTracker:function(i,I){return new D(i,I)},getAsyncTracker:function(){return F}}}()),piwik_track,piwik_log=function(b,f,d,g){function a(h){try{return eval("piwik_"+h)}catch(i){}return}var c,e=Piwik.getTracker(d,f);e.setDocumentTitle(b);if(!!(c=a("tracker_pause"))){e.setLinkTrackingTimer(c)}if(!!(c=a("download_extensions"))){e.setDownloadExtensions(c)}if(!!(c=a("hosts_alias"))){e.setDomains(c)}if(!!(c=a("ignore_classes"))){e.setIgnoreClasses(c)}e.trackPageView();if((a("install_tracker"))){piwik_track=function(i,k,j,h){e.setSiteId(k);e.setTrackerUrl(j);e.trackLink(i,h) +};e.enableLinkTracking()}};
\ No newline at end of file |