From 6f5e8d4821e1ad5e9ad502feff781a7a45c054d0 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 21 Nov 2014 11:37:53 -0500 Subject: [PATCH] Add Piwik tracking JS. --- givingguide.html | 2 ++ js/piwik.js | 85 ++++++++++++++---------------------------------- 2 files changed, 27 insertions(+), 60 deletions(-) diff --git a/givingguide.html b/givingguide.html index 6a33f51..f425498 100755 --- a/givingguide.html +++ b/givingguide.html @@ -775,6 +775,8 @@

+ + diff --git a/js/piwik.js b/js/piwik.js index a1979c1..ad306cf 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -1,66 +1,31 @@ -/*! - * Piwik - Web Analytics - * - * JavaScript tracking client - * - * @link http://piwik.org - * @source https://github.com/piwik/piwik/blob/master/js/piwik.js - * @license http://piwik.org/free-software/bsd/ Simplified BSD (also in js/LICENSE.txt) - * - * @licstart The following is the entire license notice for the JavaScript code in this page. - * - * Copyright 2010 Anthon Pang - * All rights reserved. +/* + * |@licstart The following is the entire license notice for the JavaScript code in this page.| -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: + * Copyright 2012 Matthieu Aubry. - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. - * Neither the name of Anthon Pang nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * @licend The above is the entire license notice for the JavaScript code in this page. - * + * |@licend The above is the entire license notice for the JavaScript code in this page.| */ -if(typeof JSON2!=="object"){JSON2={}}(function(){function d(f){return f<10?"0"+f:f}function l(n,m){var f=Object.prototype.toString.apply(n);if(f==="[object Date]"){return isFinite(n.valueOf())?n.getUTCFullYear()+"-"+d(n.getUTCMonth()+1)+"-"+d(n.getUTCDate())+"T"+d(n.getUTCHours())+":"+d(n.getUTCMinutes())+":"+d(n.getUTCSeconds())+"Z":null}if(f==="[object String]"||f==="[object Number]"||f==="[object Boolean]"){return n.valueOf()}if(f!=="[object Array]"&&typeof n.toJSON==="function"){return n.toJSON(m)}return n}var c=new RegExp("[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]","g"),e='\\\\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]',i=new RegExp("["+e,"g"),j,b,k={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},h; -function a(f){i.lastIndex=0;return i.test(f)?'"'+f.replace(i,function(m){var n=k[m];return typeof n==="string"?n:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+f+'"'}function g(s,p){var n,m,t,f,q=j,o,r=p[s];if(r&&typeof r==="object"){r=l(r,s)}if(typeof h==="function"){r=h.call(p,s,r)}switch(typeof r){case"string":return a(r);case"number":return isFinite(r)?String(r):"null";case"boolean":case"null":return String(r);case"object":if(!r){return"null"}j+=b;o=[];if(Object.prototype.toString.apply(r)==="[object Array]"){f=r.length;for(n=0;n>>(32-i))},ag=function(am){var al="",ak,W;for(ak=7;ak>=0;ak--){W=(am>>>(ak*4))&15;al+=W.toString(16)}return al},U,ai,ah,Q=[],Z=1732584193,X=4023233417,V=2562383102,T=271733878,S=3285377520,ae,ad,ac,ab,aa,aj,P,Y=[];af=p(af);P=af.length;for(ai=0;ai>>29);Y.push((P<<3)&4294967295);for(U=0;U=0){bo=bo.slice(0,bn)}if((bn=bo.lastIndexOf("/"))!==bo.length-1){bo=bo.slice(0,bn+1)}return bo+bm}function aP(bp){var bn,bm,bo;for(bn=0;bn0)&&(bp.slice(bo)===bm)){return true}}}return false}function bl(bm){var bn=new Image(1,1);bn.onload=function(){};bn.src=S+(S.indexOf("?")<0?"?":"&")+bm -}function a1(bm){try{var bo=A.XMLHttpRequest?new A.XMLHttpRequest():A.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null;bo.open("POST",S,true);bo.onreadystatechange=function(){if(this.readyState===4&&this.status!==200){bl(bm)}};bo.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");bo.send(bm)}catch(bn){bl(bm)}}function ax(bo,bn){var bm=new Date();if(!bc){if(aQ==="POST"){a1(bo)}else{bl(bo)}h=bm.getTime()+bn}}function aZ(bm){return bh+bm+"."+a9+"."+aU}function U(){if(aa){return"0"}if(!s(d.cookieEnabled)){var bm=aZ("testcookie");a0(bm,"1");return af(bm)==="1"?"1":"0"}return d.cookieEnabled?"1":"0"}function aJ(){aU=av((ac||a5)+(bi||"/")).slice(0,4)}function ae(){var bn=aZ("cvar"),bm=af(bn);if(bm.length){bm=JSON2.parse(bm);if(C(bm)){return bm}}return{}}function R(){if(V===false){V=ae()}}function a8(){var bm=new Date();aR=bm.getTime()}function ab(bq,bn,bm,bp,bo,br){a0(aZ("id"),bq+"."+bn+"."+bm+"."+bp+"."+bo+"."+br,ag,bi,ac)}function Q(){var bn=new Date(),bm=Math.round(bn.getTime()/1000),bp=af(aZ("id")),bo; -if(bp){bo=bp.split(".");bo.unshift("0")}else{if(!aA){aA=av((d.userAgent||"")+(d.platform||"")+JSON2.stringify(ba)+bm).slice(0,16)}bo=["1",aA,bm,0,bm,"",""]}return bo}function i(){var bm=af(aZ("ref"));if(bm.length){try{bm=JSON2.parse(bm);if(C(bm)){return bm}}catch(bn){}}return["","",0,""]}function P(){var bm=aa;aa=false;a0(aZ("id"),"",-86400,bi,ac);a0(aZ("ses"),"",-86400,bi,ac);a0(aZ("cvar"),"",-86400,bi,ac);a0(aZ("ref"),"",-86400,bi,ac);aa=bm}function at(bo,bM,bN,bq){var bK,bn=new Date(),bw=Math.round(bn.getTime()/1000),bP,bL,bs,bD,bH,bv,bF,bt,bJ,br=1024,bQ,bz,bG=V,bx=aZ("ses"),by=aZ("ref"),bR=aZ("cvar"),bE=Q(),bB=af(bx),bI=i(),bO=aC||bj,bu,bm;if(aa){P()}if(bc){return""}bP=bE[0];bL=bE[1];bD=bE[2];bs=bE[3];bH=bE[4];bv=bE[5];if(!s(bE[6])){bE[6]=""}bF=bE[6];if(!s(bq)){bq=""}var bA=q.characterSet||q.charset;if(!bA||bA.toLowerCase()==="utf-8"){bA=null}bu=bI[0];bm=bI[1];bt=bI[2];bJ=bI[3];if(!bB){bs++;bv=bH;if(!aB||!bu.length){for(bK in aw){if(Object.prototype.hasOwnProperty.call(aw,bK)){bu=B(bO,aw[bK]); -if(bu.length){break}}}for(bK in aq){if(Object.prototype.hasOwnProperty.call(aq,bK)){bm=B(bO,aq[bK]);if(bm.length){break}}}}bQ=b(aS);bz=bJ.length?b(bJ):"";if(bQ.length&&!aP(bQ)&&(!aB||!bz.length||aP(bz))){bJ=aS}if(bJ.length||bu.length){bt=bw;bI=[bu,bm,bt,be(bJ.slice(0,br))];a0(by,JSON2.stringify(bI),aD,bi,ac)}}bo+="&idsite="+a9+"&rec=1&r="+String(Math.random()).slice(2,8)+"&h="+bn.getHours()+"&m="+bn.getMinutes()+"&s="+bn.getSeconds()+"&url="+k(be(bO))+(aS.length?"&urlref="+k(be(aS)):"")+"&_id="+bL+"&_idts="+bD+"&_idvc="+bs+"&_idn="+bP+(bu.length?"&_rcn="+k(bu):"")+(bm.length?"&_rck="+k(bm):"")+"&_refts="+bt+"&_viewts="+bv+(String(bF).length?"&_ects="+bF:"")+(String(bJ).length?"&_ref="+k(be(bJ.slice(0,br))):"")+(bA?"&cs="+k(bA):"");var bp=JSON2.stringify(aH);if(bp.length>2){bo+="&cvar="+k(bp)}for(bK in ba){if(Object.prototype.hasOwnProperty.call(ba,bK)){bo+="&"+bK+"="+ba[bK]}}if(bM){bo+="&data="+k(JSON2.stringify(bM))}else{if(Z){bo+="&data="+k(JSON2.stringify(Z))}}if(V){var bC=JSON2.stringify(V); -if(bC.length>2){bo+="&_cvar="+k(bC)}for(bK in bG){if(Object.prototype.hasOwnProperty.call(bG,bK)){if(V[bK][0]===""||V[bK][1]===""){delete V[bK]}}}a0(bR,JSON2.stringify(V),ai,bi,ac)}if(az&&an){bo+=">_ms="+an}else{if(az&&e&&e.timing&&e.timing.requestStart&&e.timing.responseEnd){bo+=">_ms="+(e.timing.responseEnd-e.timing.requestStart)}}ab(bL,bD,bs,bw,bv,s(bq)&&String(bq).length?bq:bF);a0(bx,"*",ai,bi,ac);bo+=I(bN);if(aN.length){bo+="&"+aN}return bo}function a3(bp,bo,bt,bq,bm,bw){var br="idgoal=0",bs,bn=new Date(),bu=[],bv;if(String(bp).length){br+="&ec_id="+k(bp);bs=Math.round(bn.getTime()/1000)}br+="&revenue="+bo;if(String(bt).length){br+="&ec_st="+bt}if(String(bq).length){br+="&ec_tx="+bq}if(String(bm).length){br+="&ec_sh="+bm}if(String(bw).length){br+="&ec_dt="+bw}if(aY){for(bv in aY){if(Object.prototype.hasOwnProperty.call(aY,bv)){if(!s(aY[bv][1])){aY[bv][1]=""}if(!s(aY[bv][2])){aY[bv][2]=""}if(!s(aY[bv][3])||String(aY[bv][3]).length===0){aY[bv][3]=0}if(!s(aY[bv][4])||String(aY[bv][4]).length===0){aY[bv][4]=1 -}bu.push(aY[bv])}}br+="&ec_items="+k(JSON2.stringify(bu))}br=at(br,Z,"ecommerce",bs);ax(br,aM)}function a2(bm,bq,bp,bo,bn,br){if(String(bm).length&&s(bq)){a3(bm,bq,bp,bo,bn,br)}}function bg(bm){if(s(bm)){a3("",bm,"","","","")}}function aF(bp,bq){var bm=new Date(),bo=at("action_name="+k(O(bp||ar)),bq,"log");ax(bo,aM);if(X&&al&&!aT){aT=true;N(q,"click",a8);N(q,"mouseup",a8);N(q,"mousedown",a8);N(q,"mousemove",a8);N(q,"mousewheel",a8);N(A,"DOMMouseScroll",a8);N(A,"scroll",a8);N(q,"keypress",a8);N(q,"keydown",a8);N(q,"keyup",a8);N(A,"resize",a8);N(A,"focus",a8);N(A,"blur",a8);aR=bm.getTime();setTimeout(function bn(){var br=new Date(),bs;if((aR+al)>br.getTime()){if(X0){bm=s(bm)&&!l(bm)?String(bm):bm;bq=s(bq)&&!l(bq)?String(bq):bq;bp=[bm.slice(0,bd),bq.slice(0,bd)];if(bo==="visit"||bo===2){R();V[bn]=bp}else{if(bo==="page"||bo===3){aH[bn]=bp -}}}},getCustomVariable:function(bn,bo){var bm;if(!s(bo)){bo="visit"}if(bo==="page"||bo===3){bm=aH[bn]}else{if(bo==="visit"||bo===2){R();bm=V[bn]}}if(!s(bm)||(bm&&bm[0]==="")){return false}return bm},deleteCustomVariable:function(bm,bn){if(this.getCustomVariable(bm,bn)){this.setCustomVariable(bm,"","",bn)}},setLinkTrackingTimer:function(bm){aM=bm},setDownloadExtensions:function(bm){au=bm},addDownloadExtensions:function(bm){au+="|"+bm},setDomains:function(bm){aO=l(bm)?[bm]:bm;aO.push(a5)},setIgnoreClasses:function(bm){W=l(bm)?[bm]:bm},setRequestMethod:function(bm){aQ=bm||"GET"},setReferrerUrl:function(bm){aS=bm},setCustomUrl:function(bm){aC=a4(bj,bm)},setDocumentTitle:function(bm){ar=bm},setAPIUrl:function(bm){ah=bm},setDownloadClasses:function(bm){aG=l(bm)?[bm]:bm},setLinkClasses:function(bm){aj=l(bm)?[bm]:bm},setCampaignNameKey:function(bm){aw=l(bm)?[bm]:bm},setCampaignKeywordKey:function(bm){aq=l(bm)?[bm]:bm},discardHashTag:function(bm){Y=bm},setCookieNamePrefix:function(bm){bh=bm;V=ae() -},setCookieDomain:function(bm){ac=u(bm);aJ()},setCookiePath:function(bm){bi=bm;aJ()},setVisitorCookieTimeout:function(bm){ag=bm*1000},setSessionCookieTimeout:function(bm){ai=bm*1000},setReferralCookieTimeout:function(bm){aD=bm*1000},setConversionAttributionFirstReferrer:function(bm){aB=bm},disableCookies:function(){aa=true;ba.cookie="0"},deleteCookies:function(){P()},setDoNotTrack:function(bn){var bm=d.doNotTrack||d.msDoNotTrack;bc=bn&&(bm==="yes"||bm==="1");if(bc){this.disableCookies()}},addListener:function(bn,bm){aW(bn,bm)},enableLinkTracking:function(bm){if(n){aE(bm)}else{y.push(function(){aE(bm)})}},disablePerformanceTracking:function(){az=false},setGenerationTimeMs:function(bm){an=parseInt(bm,10)},setHeartBeatTimer:function(bo,bn){var bm=new Date();X=bm.getTime()+bo*1000;al=bn*1000},killFrame:function(){if(A.location!==A.top.location){A.top.location=A.location}},redirectFile:function(bm){if(A.location.protocol==="file:"){A.location=bm}},setCountPreRendered:function(bm){ay=bm},trackGoal:function(bm,bo,bn){ao(function(){aK(bm,bo,bn) -})},trackLink:function(bn,bm,bo){ao(function(){a7(bn,bm,bo)})},trackPageView:function(bm,bn){if(v(a9)){ao(function(){F(S,ah,a9)})}else{ao(function(){aF(bm,bn)})}},trackSiteSearch:function(bm,bo,bn){ao(function(){ap(bm,bo,bn)})},setEcommerceView:function(bp,bm,bo,bn){if(!s(bo)||!bo.length){bo=""}else{if(bo instanceof Array){bo=JSON2.stringify(bo)}}aH[5]=["_pkc",bo];if(s(bn)&&String(bn).length){aH[2]=["_pkp",bn]}if((!s(bp)||!bp.length)&&(!s(bm)||!bm.length)){return}if(s(bp)&&bp.length){aH[3]=["_pks",bp]}if(!s(bm)||!bm.length){bm=""}aH[4]=["_pkn",bm]},addEcommerceItem:function(bq,bm,bo,bn,bp){if(bq.length){aY[bq]=[bq,bm,bo,bn,bp]}},trackEcommerceOrder:function(bm,bq,bp,bo,bn,br){a2(bm,bq,bp,bo,bn,br)},trackEcommerceCartUpdate:function(bm){bg(bm)}}}function r(){return{push:K}}N(A,"beforeunload",L,false);m();Date.prototype.getTimeAlias=Date.prototype.getTime;E=new x();for(H=0;H<_paq.length;H++){if(_paq[H][0]==="setTrackerUrl"||_paq[H][0]==="setSiteId"){K(_paq[H]);delete _paq[H]}}for(H=0;H<_paq.length; -H++){if(_paq[H]){K(_paq[H])}}_paq=new r();c={addPlugin:function(i,P){a[i]=P},getTracker:function(i,P){return new x(i,P)},getAsyncTracker:function(){return E}};if(typeof define==="function"&&define.amd){define(["piwik"],[],function(){return c})}return c}())}if(typeof piwik_log!=="function"){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);e.setCustomData(g);c=a("tracker_pause");if(c){e.setLinkTrackingTimer(c)}c=a("download_extensions");if(c){e.setDownloadExtensions(c)}c=a("hosts_alias");if(c){e.setDomains(c)}c=a("ignore_classes");if(c){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()}}}; +var _paq = _paq || []; +_paq.push(["trackPageView"]); +_paq.push(["enableLinkTracking"]); + +(function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.fsf.org/"; + _paq.push(["setTrackerUrl", u+"piwik.php"]); + _paq.push(["setSiteId", "10"]); + var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; + g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s); +})(); -- 2.25.1