From 0dce6211d672dada564cd15188dbc4ee66700093 Mon Sep 17 00:00:00 2001 From: Thomas Thune Hansen Date: Thu, 24 Jul 2014 09:31:49 +0200 Subject: [PATCH 1/2] Updated to webtrends 10.4.1. --- translations/da.po | 51 ++- translations/webtrends.pot | 18 +- webtrends.admin.inc | 7 + webtrends.info | 1 - webtrends.js | 791 ------------------------------------- webtrends.min.js | 49 +++ webtrends.module | 73 +++- 7 files changed, 154 insertions(+), 836 deletions(-) delete mode 100644 webtrends.js create mode 100644 webtrends.min.js diff --git a/translations/da.po b/translations/da.po index fbe5ab0..7c892e0 100644 --- a/translations/da.po +++ b/translations/da.po @@ -1,50 +1,65 @@ -# Danish translation of locale.d6.dev -# Generated by admin +# $Id$ +# +# LANGUAGE translation of Drupal (general) +# Copyright YEAR NAME +# Generated from files: +# webtrends.admin.inc: n/a +# webtrends.module: n/a +# webtrends.info: n/a # msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2011-01-19 14:29+0100\n" -"PO-Revision-Date: 2011-01-19 12:57+0100\n" +"POT-Creation-Date: 2014-07-23 14:43+0200\n" +"PO-Revision-Date: 2014-07-23 14:48+0100\n" "Last-Translator: NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n!=1);\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"X-Generator: Poedit 1.5.4\n" #: webtrends.admin.inc:12 msgid "Hostname" msgstr "Værtsnavn" #: webtrends.admin.inc:13 -msgid "The hostname of the WebTrends server (gDomain)." +msgid "The hostname of the tracked site." msgstr "" -#: webtrends.admin.inc:20 -msgid "The site identification key (gDcsId)." +#: webtrends.admin.inc:19 +msgid "Site ID" msgstr "" -#: webtrends.module:30 -msgid "Webtrends module not configured." +#: webtrends.admin.inc:20 +msgid "The site identification key." msgstr "" -#: webtrends.module:12 -msgid "Settings for the WebTrends analytics tool." -msgstr "" +#: webtrends.admin.inc:26 +msgid "Enable \"Error pages\" parameters" +msgstr "Aktiver \"Error pages\" parametre" -#: webtrends.admin.inc:19 -msgid "Site ID" -msgstr "" +#: webtrends.admin.inc:27 +msgid "Add webtrends error page parameters to url, for 404 pages" +msgstr "Tilføjer webtrends error page parametre til url'en på 404 sider" #: webtrends.module:30 msgid "webtrends" msgstr "" -#: webtrends.module:11 webtrends.info:0 +#: webtrends.module:30 +msgid "Webtrends module not configured." +msgstr "" + +#: webtrends.module:10 webtrends.info:0 msgid "WebTrends" msgstr "" +#: webtrends.module:11 +msgid "Settings for the WebTrends analytics tool." +msgstr "" + #: webtrends.info:0 msgid "Adds WebTrends JavaScript tracking code to all your site's pages." msgstr "" diff --git a/translations/webtrends.pot b/translations/webtrends.pot index f82a760..3d81da0 100644 --- a/translations/webtrends.pot +++ b/translations/webtrends.pot @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2011-01-19 14:29+0100\n" +"POT-Creation-Date: 2014-07-23 14:43+0200\n" "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" "Last-Translator: NAME \n" "Language-Team: LANGUAGE \n" @@ -25,7 +25,7 @@ msgid "Hostname" msgstr "" #: webtrends.admin.inc:13 -msgid "The hostname of the WebTrends server (gDomain)." +msgid "The hostname of the tracked site." msgstr "" #: webtrends.admin.inc:19 @@ -33,7 +33,15 @@ msgid "Site ID" msgstr "" #: webtrends.admin.inc:20 -msgid "The site identification key (gDcsId)." +msgid "The site identification key." +msgstr "" + +#: webtrends.admin.inc:26 +msgid "Enable \"Error pages\" parameters" +msgstr "" + +#: webtrends.admin.inc:27 +msgid "Add webtrends error page parameters to url, for 404 pages" msgstr "" #: webtrends.module:30 @@ -44,11 +52,11 @@ msgstr "" msgid "Webtrends module not configured." msgstr "" -#: webtrends.module:11 webtrends.info:0 +#: webtrends.module:10 webtrends.info:0 msgid "WebTrends" msgstr "" -#: webtrends.module:12 +#: webtrends.module:11 msgid "Settings for the WebTrends analytics tool." msgstr "" diff --git a/webtrends.admin.inc b/webtrends.admin.inc index a2c25bc..b09bbbe 100644 --- a/webtrends.admin.inc +++ b/webtrends.admin.inc @@ -21,6 +21,13 @@ function webtrends_admin_settings_form($form_state) { '#default_value' => variable_get('webtrends_dcs_id', FALSE), ); + $form['webtrends_error_pages'] = array( + '#type' => 'checkbox', + '#title' => t('Enable "Error pages" parameters'), + '#description' => t('Add webtrends error page parameters to url, for 404 pages'), + '#default_value' => variable_get('webtrends_error_pages', FALSE), + ); + // Delete the generated file js/webtrends_include1.js. $form['#submit'][] = 'drupal_clear_js_cache'; diff --git a/webtrends.info b/webtrends.info index 39bc76e..2811de6 100644 --- a/webtrends.info +++ b/webtrends.info @@ -2,4 +2,3 @@ name = WebTrends description = Adds WebTrends JavaScript tracking code to all your site's pages. core = 6.x - diff --git a/webtrends.js b/webtrends.js deleted file mode 100644 index e2025e3..0000000 --- a/webtrends.js +++ /dev/null @@ -1,791 +0,0 @@ -// WebTrends SmartSource Data Collector Tag -// Version: 9.3.0 -// Tag Builder Version: 3.1 -// Created: 1/10/2011 1:51:53 PM - -function WebTrends(){ - var that=this; - // begin: user modifiable - // this.dcsid="unconfigured"; - this.domain="visionize10.visionize.dk"; - this.timezone=1; - // this.fpcdom=".example.com"; - this.onsitedoms=""; - this.downloadtypes="arc,arj,ashx,avi,bin,dll,doc,docx,exe,gz,hqx,mp2,mp3,mp4,mpeg,mpg,pdf,pps,ppsx,ppt,pptx,rar,rpm,sit,svg,swf,tar,txt,wav,xls,xlsx,z,zip"; - this.navigationtag="div,table"; - this.adclickparam="WT.ac"; - this.trackevents=true; - this.trimoffsiteparams=true; - this.enabled=true; - this.i18n=false; - this.fpc="WT_FPC"; - this.paidsearchparams="gclid"; - this.splitvalue=""; - this.preserve=true; - // end: user modifiable - this.DCS={}; - this.WT={}; - this.DCSext={}; - this.images=[]; - this.index=0; - this.exre=(function(){return(window.RegExp?new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)","i"):"");})(); - this.re=(function(){return(window.RegExp?(that.i18n?{"%25":/\%/g,"%26":/\&/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}):"");})(); -} -WebTrends.prototype.dcsGetId=function(){ - if (this.enabled&&(document.cookie.indexOf(this.fpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){ - document.write("<\/scr"+"ipt>"); - } -} -WebTrends.prototype.dcsGetCookie=function(name){ - var cookies=document.cookie.split("; "); - var cmatch=[]; - var idx=0; - var i=0; - var namelen=name.length; - var clen=cookies.length; - for (i=0;i0){ - idx=0; - if ((cmatchCount>1)&&(name==this.fpc)){ - var dLatest=new Date(0); - for (i=0;idLatest){ - dLatest.setTime(dLst.getTime()); - idx=i; - } - } - } - return unescape(cmatch[idx].substring(namelen+1)); - } - else{ - return null; - } -} -WebTrends.prototype.dcsGetCrumb=function(cval,crumb,sep){ - var aCookie=cval.split(sep||":"); - for (var i=0;i(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){ - WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000); - dSes.setTime(dCur.getTime()); - WT.vt_f_s="1"; - } - if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){ - WT.vt_f_d="1"; - } - } - WT.co_f=escape(WT.co_f); - WT.vtid=(typeof(this.vtid)=="undefined")?WT.co_f:(this.vtid||""); - WT.vtvs=(dSes.getTime()-adj).toString(); - var expiry="; expires="+dExp.toGMTString(); - var cur=dCur.getTime().toString(); - var ses=dSes.getTime().toString(); - document.cookie=name+"="+"id="+WT.co_f+":lv="+cur+":ss="+ses+expiry+"; path=/"+(((this.fpcdom!=""))?("; domain="+this.fpcdom):("")); - var rc=this.dcsIsFpcSet(name,WT.co_f,cur,ses); - if (rc!=0){ - WT.co_f=WT.vtvs=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv=""; - if (typeof(this.vtid)=="undefined"){ - WT.vtid=""; - } - WT.vt_f=WT.vt_f_a=rc; - } -} -// Code section for Generate an Ad View query parameter for every Ad Click link. -WebTrends.prototype.dcsAdSearch=function(){ - if (document.links){ - var param=this.adclickparam+"="; - var paramlen=param.length; - var paramre=new RegExp(param,"i"); - var len=document.links.length; - var pos=end=-1; - var anch=urlp=value=""; - var urlpre; - var url=document.URL+""; - var start=url.search(paramre); - if (start!=-1){ - end=url.indexOf("&",start); - urlp=url.substring(start,(end!=-1)?end:url.length); - urlpre=new RegExp(urlp+"(&|#)","i"); - } - for (var i=0;i0){ - anch=anch.replace(urlpre,"$1"); - } - pos=anch.search(paramre); - if (pos!=-1){ - start=pos+paramlen; - end=anch.indexOf("&",start); - value=anch.substring(start,(end!=-1)?end:anch.length); - this.WT.ad=this.WT.ad?(this.WT.ad+";"+value):value; - } - } - } - } -} -WebTrends.prototype.dcsIsOnsite=function(host){ - if (host.length>0){ - host=host.toLowerCase(); - if (host==window.location.hostname.toLowerCase()){ - return true; - } - if (typeof(this.onsitedoms.test)=="function"){ - return this.onsitedoms.test(host); - } - else if (this.onsitedoms.length>0){ - var doms=this.dcsSplit(this.onsitedoms); - var len=doms.length; - for (var i=0;i0)&&(pr.indexOf("http")==0)&&!this.dcsIsOnsite(hn)){ - var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):""; - var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/"; - this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsuri", pth, "DCS.dcsqry", this.trimoffsiteparams ? "" : qry, "DCS.dcsref", window.location, "WT.ti", "Offsite:" + hn + pth + (qry.length ? ("?" + qry) : ""), "WT.dl", "24", "WT.nv", this.dcsNavigation(evt)); - } - } - } -} - -WebTrends.prototype.dcsAdv=function(){ - if (this.trackevents&&(typeof(this.dcsET)=="function")){ - if (window.addEventListener){ - window.addEventListener("load",this.dcsET.wtbind(this),false); - } - else if (window.attachEvent){ - window.attachEvent("onload",this.dcsET.wtbind(this)); - } - } - this.dcsFPC(); - this.dcsAdSearch(); -} -WebTrends.prototype.dcsVar=function(){ - var dCurrent=new Date(); - var WT=this.WT; - var DCS=this.DCS; - WT.tz=parseInt(dCurrent.getTimezoneOffset()/60*-1)||"0"; - WT.bh=dCurrent.getHours()||"0"; - WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage; - if (typeof(screen)=="object"){ - WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth; - WT.sr=screen.width+"x"+screen.height; - } - if (typeof(navigator.javaEnabled())=="boolean"){ - WT.jo=navigator.javaEnabled()?"Yes":"No"; - } - if (document.title){ - if (window.RegExp){ - var tire=new RegExp("^"+window.location.protocol+"//"+window.location.hostname+"\\s-\\s"); - WT.ti=document.title.replace(tire,""); - } - else{ - WT.ti=document.title; - } - } - WT.js="Yes"; - WT.jv=(function(){ - var agt=navigator.userAgent.toLowerCase(); - var major=parseInt(navigator.appVersion); - var mac=(agt.indexOf("mac")!=-1); - var ff=(agt.indexOf("firefox")!=-1); - var ff0=(agt.indexOf("firefox/0.")!=-1); - var ff10=(agt.indexOf("firefox/1.0")!=-1); - var ff15=(agt.indexOf("firefox/1.5")!=-1); - var ff20=(agt.indexOf("firefox/2.0")!=-1); - var ff3up=(ff&&!ff0&&!ff10&!ff15&!ff20); - var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1)); - var nn4=(nn&&(major==4)); - var nn6up=(nn&&(major>=5)); - var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1)); - var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1)); - var ie5up=(ie&&!ie4); - var op=(agt.indexOf("opera")!=-1); - var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1); - var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1); - var op7up=(op&&!op5&&!op6); - var jv="1.1"; - if (ff3up){ - jv="1.8"; - } - else if (ff20){ - jv="1.7"; - } - else if (ff15){ - jv="1.6"; - } - else if (ff0||ff10||nn6up||op7up){ - jv="1.5"; - } - else if ((mac&&ie5up)||op6){ - jv="1.4"; - } - else if (ie5up||nn4||op5){ - jv="1.3"; - } - else if (ie4){ - jv="1.2"; - } - return jv; - })(); - WT.ct="unknown"; - if (document.body&&document.body.addBehavior){ - try{ - document.body.addBehavior("#default#clientCaps"); - WT.ct=document.body.connectionType||"unknown"; - document.body.addBehavior("#default#homePage"); - WT.hp=document.body.isHomePage(location.href)?"1":"0"; - } - catch(e){ - } - } - if (document.all){ - WT.bs=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"unknown"; - } - else{ - WT.bs=window.innerWidth+"x"+window.innerHeight; - } - WT.fv=(function(){ - var i,flash; - if (window.ActiveXObject){ - for(i=15;i>0;i--){ - try{ - flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i); - return i+".0"; - } - catch(e){ - } - } - } - else if (navigator.plugins&&navigator.plugins.length){ - for (i=0;i0;i--){ - M=i; - if (Silverlight.isInstalled(M+".0")){ - break; - } - if (slv==M){ - break; - } - } - for (m=9;m>=0;m--){ - F=M+"."+m; - if (Silverlight.isInstalled(F)){ - slv=F; - break; - } - if (slv==F){ - break; - } - } - } - } - return slv; - })(); - if (this.i18n){ - if (typeof(document.defaultCharset)=="string"){ - WT.le=document.defaultCharset; - } - else if (typeof(document.characterSet)=="string"){ - WT.le=document.characterSet; - } - else{ - WT.le="unknown"; - } - } - WT.tv="9.3.0"; - WT.sp=this.splitvalue; - WT.dl="0"; - WT.ssl=(window.location.protocol.indexOf('https:')==0)?"1":"0"; - DCS.dcsdat=dCurrent.getTime(); - DCS.dcssip=window.location.hostname; - DCS.dcsuri=window.location.pathname; - WT.es=DCS.dcssip+DCS.dcsuri; - if (window.location.search){ - DCS.dcsqry=window.location.search; - } - if (DCS.dcsqry){ - var dcsqry=DCS.dcsqry.toLowerCase(); - var params=this.paidsearchparams.length?this.paidsearchparams.toLowerCase().split(","):[]; - for (var i=0;i'); - } -} -WebTrends.prototype.dcsMeta=function(){ - var elems; - if (document.documentElement){ - elems=document.getElementsByTagName("meta"); - } - else if (document.all){ - elems=document.all.tags("meta"); - } - if (typeof(elems)!="undefined"){ - var length=elems.length; - for (var i=0;i0){ - if (name.toUpperCase().indexOf("WT.")==0){ - this.WT[name.substring(3)]=content; - } - else if (name.toUpperCase().indexOf("DCSEXT.")==0){ - this.DCSext[name.substring(7)]=content; - } - else if (name.toUpperCase().indexOf("DCS.")==0){ - this.DCS[name.substring(4)]=content; - } - } - } - } -} -WebTrends.prototype.dcsTag=function(){ - if (document.cookie.indexOf("WTLOPTOUT=")!=-1){ - return; - } - var WT=this.WT; - var DCS=this.DCS; - var DCSext=this.DCSext; - var i18n=this.i18n; - var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+(this.dcsid==""?'':'/'+this.dcsid)+"/dcs.gif?"; - if (i18n){ - WT.dep=""; - } - for (var N in DCS){ - if (DCS[N]&&(typeof DCS[N]!="function")){ - P+=this.dcsA(N,DCS[N]); - } - } - for (N in WT){ - if (WT[N]&&(typeof WT[N]!="function")){ - P+=this.dcsA("WT."+N,WT[N]); - } - } - for (N in DCSext){ - if (DCSext[N]&&(typeof DCSext[N]!="function")){ - if (i18n){ - WT.dep=(WT.dep.length==0)?N:(WT.dep+";"+N); - } - P+=this.dcsA(N,DCSext[N]); - } - } - if (i18n&&(WT.dep.length>0)){ - P+=this.dcsA("WT.dep",WT.dep); - } - if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){ - P=P.substring(0,2040)+"&WT.tu=1"; - } - this.dcsCreateImage(P); - this.WT.ad=""; -} -WebTrends.prototype.dcsDebug=function(){ - var t=this; - var i=t.images[0].src; - var q=i.indexOf("?"); - var r=i.substring(0,q).split("/"); - var m="Protocol
"+r[0]+"
"; - m+="Domain
"+r[2]+"
"; - m+="Path
/"+r[3]+"/"+r[4]+"
"; - m+="Query Params"+i.substring(q+1).replace(/\&/g,"
")+"
"; - m+="
Cookies
"+document.cookie.replace(/\;/g,"
")+"
"; - if (t.w&&!t.w.closed){ - t.w.close(); - } - t.w=window.open("","dcsDebug","width=500,height=650,scrollbars=yes,resizable=yes"); - t.w.document.write(m); - t.w.focus(); -} -WebTrends.prototype.dcsCollect=function(){ - if (this.enabled){ - this.dcsVar(); - this.dcsMeta(); - this.dcsAdv(); - if (typeof(this.dcsCustom)=="function"){ - this.dcsCustom(); - } - this.dcsTag(); - } -} - -function dcsMultiTrack(){ - if (typeof(_tag)!="undefined"){ - return(_tag.dcsMultiTrack()); - } -} - -function dcsDebug(){ - if (typeof(_tag)!="undefined"){ - return(_tag.dcsDebug()); - } -} - -Function.prototype.wtbind = function(obj){ - var method=this; - var temp=function(){ - return method.apply(obj,arguments); - }; - return temp; -} \ No newline at end of file diff --git a/webtrends.min.js b/webtrends.min.js new file mode 100644 index 0000000..1867482 --- /dev/null +++ b/webtrends.min.js @@ -0,0 +1,49 @@ +var n=void 0; +(function(i,j,k,l){function m(a){if(a){if(!a.forEach)a.forEach=function(a,c){for(var e=c||window,d=0,g=this.length;d8){var b=j.body;return function(a){return b.querySelectorAll(a)}}if(i.jQuery)return i.jQuery.find;if(i.Sizzle)return i.Sizzle;if(i.YAHOO&& +YAHOO.za&&YAHOO.za.Aa)return YAHOO.za.Aa.Nb;if("qwery"in i)return qwery;i.YUI&&YUI().Pb("node",function(a){return a.all});return j.querySelectorAll?(b=j.body)?function(a){return b.querySelectorAll(a)}:function(){return[]}:function(){return[]}},pa:function(a){var a=a.split(/[&?]/g),b={};try{for(var c=0,e=a.length;c=8?"mousedown":"mouseup",function(b){if(!b)b=window.event;d.Pa(a,{event:b})}); +d.ta=!0}d.h[a]||(d.h[a]={});if(c)e(c,b);else for(var g in d.e)e(d.e[g],b)}},Pa:function(a,b){for(var c in d.e)d.fireEvent(a,d.e[c],b)},Ca:function(a,b,c,e){if(typeof b==="function")return b.onetime?(c.push(b),!0):(b(a,e),!1)},fireEvent:function(a,b,c){var e=m([]);if(d.h[a]&&d.h[a][b.n]){a=d.h[a][b.n];if(!a.length)return;for(var f=a.length-1;f>=0;f--)d.Ca(b,a[f],e,c)&&a.pop()}e.forEach(function(a){a(b,c)})},ca:function(a,b){var c=!1,e;for(e in d.e){var f=d.e[e];a in f.plugins&&(c=!0,f.ca(a,b))}c|| +b({Mb:!0})},T:function(a,b){for(var c=j.cookie.split("; "),e=[],d=0,g=0,h=a.length,p=c.length,g=0;g0){d=0;if(c>1&&a==b){p=new Date(0);for(g=0;gp&&(p.setTime(i.getTime()),d=g)}return unescape(e[d].substring(h+1))}else return null},Wa:function(a,b,c){a=a.split(c||":");for(c=0;ch.getTime()+18E5||c.getTime()>f.getTime()+288E5)a.vt_f_tlv=Math.floor((f.getTime()-e)/1E3),f.setTime(c.getTime()),a.vt_f_s="1";if(c.getDate()!=h.getDate()||c.getMonth()!=h.getMonth()||c.getFullYear()!=h.getFullYear())a.vt_f_d="1"}else{if(this.X.length)a.co_f=d.f[this.domain].length?d.f[this.domain]:this.X,a.vt_f="1";else if(d.f[this.domain].length)a.co_f=d.f[this.domain];else{a.co_f="2";i=c.getTime().toString();for(h=2;h<=32-i.length;h++)a.co_f+=Math.floor(Math.random()* +16).toString(16);a.co_f+=i;a.vt_f="1"}this.oa.length==0&&(a.vt_f_a="1");a.vt_f_s=a.vt_f_d="1";a.vt_f_tlh=a.vt_f_tlv="0"}a.co_f=escape(a.co_f);a.vtid=typeof this.M=="undefined"?a.co_f:this.M||"";a.vtvs=(f.getTime()-e).toString();e=(this.a.wb?"":"; expires="+this.a.kb.toGMTString())+"; path=/"+(this.a.domain!=""?"; domain="+this.a.domain:"");c=c.getTime().toString();f=f.getTime().toString();g.id=a.co_f;g.lv=c;g.ss=f;this.cb(b,g,e);b=this.$a(b,a.co_f,c,f);if(b!=0)a.co_f=a.vtvs=a.vt_f_s=a.vt_f_d=a.vt_f_tlh= +a.vt_f_tlv="",typeof this.M=="undefined"&&(a.vtid=""),a.vt_f=a.vt_f_a=b}else this.d.vtid=this.M?this.M:"",this.Ta(this.a.name,"/",this.a.domain)},Cb:function(){try{var a;arguments&&arguments.length>1?a={argsa:Array.prototype.slice.call(arguments)}:arguments.length===1&&(a=arguments[0]);typeof a==="undefined"&&(a={element:n,event:n,Fb:[]});typeof a.argsa==="undefined"&&(a.argsa=[]);this.la("collect",a);return this}catch(b){this.ma.push(b),this.I(b)}},ha:function(a){a&&a.length>1&&(a={argsa:Array.prototype.slice.call(arguments)}); +this.ea(a)},ea:function(a){try{typeof a==="undefined"&&(a={});this.la("multitrack",a);if(a.delayTime){var b=Number(a.delayTime);this.ya(isNaN(b)?d.t:b)}else this.ib&&this.ya(d.t);return!1}catch(c){this.ma.push(c),this.I(c)}},Ra:function(){this.j={};this.d={};this.q={};arguments.length%2==0&&this.U(arguments)},U:function(a){if(a)for(var b=0,c=a.length;b=5||a?o="1.5":c&&i||m?o="1.4":i||j&&b==4||l?o="1.3": +k&&(o="1.2");return o}();c.ct="unknown";if(j.body&&j.body.addBehavior)try{j.body.addBehavior("#default#clientCaps"),c.ct=j.body.Hb||"unknown",j.body.addBehavior("#default#homePage"),c.hp=j.body.Lb(location.href)?"1":"0"}catch(f){b.I(f)}var g=0,h=0;if(typeof i.innerWidth=="number")g=i.innerWidth,h=i.innerHeight;else if(j.documentElement&&(j.documentElement.clientWidth||j.documentElement.clientHeight))g=j.documentElement.clientWidth,h=j.documentElement.clientHeight;else if(j.body&&(j.body.clientWidth|| +j.body.clientHeight))g=j.body.clientWidth,h=j.body.clientHeight;c.bs=g+"x"+h;c.fv=function(){var a;if(i.ActiveXObject)for(a=15;a>0;a--)try{return new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a),a+".0"}catch(c){b.I(c)}else if(k.plugins&&k.plugins.length)for(a=0;a0;d--){e=d;if(Silverlight.qa(e+".0"))break;if(a==e)break}for(d=9;d>=0;d--){f=e+"."+d;if(Silverlight.qa(f)){a=f;break}if(a==f)break}}}return a}();this.Z&&(c.le=typeof j.defaultCharset=="string"?j.defaultCharset:typeof j.characterSet=="string"?j.characterSet:"unknown");c.tv=d.version;c.sp=this.yb;c.dl="0";if(d.i&&d.i.lb)c.fb_ref= +d.i.lb;if(d.i&&d.i.mb)c.fb_source=d.i.mb;c.ssl=l.protocol.indexOf("https:")==0?"1":"0";e.dcsdat=a.getTime();e.dcssip=l.hostname;e.dcsuri=l.pathname;c.es=e.dcssip+e.dcsuri;if(l.search)e.dcsqry=l.search;if(e.dcsqry){a=e.dcsqry.toLowerCase();g=this.ua.length?this.ua.toLowerCase().split(","):[];for(h=0;h0&&(d=d.toLowerCase(),d.toUpperCase().indexOf("WT.")==0?this.d[d.substring(3)]= +f:d.toUpperCase().indexOf("DCSEXT.")==0?this.q[d.substring(7)]=f:d.toUpperCase().indexOf("DCS.")==0?this.j[d.substring(4)]=f:this.ra&&this.ra.indexOf(d)!=-1&&(this.q["meta_"+d]=f))}},ia:function(a){if(j.cookie.indexOf("WTLOPTOUT=")==-1){var b=this.d,c=this.j,e=this.q,f=this.i18n,g="http"+(l.protocol.indexOf("https:")==0?"s":"")+"://"+this.domain+(this.dcsid==""?"":"/"+this.dcsid)+"/dcs.gif?";f&&(b.dep="");for(var h in c)c[h]!=""&&c[h]!=n&&typeof c[h]!="function"&&(g+=this.S(h,c[h]));for(h in b)b[h]!= +""&&b[h]!=n&&typeof b[h]!="function"&&(g+=this.S("WT."+h,b[h]));for(h in e)if(e[h]!=""&&e[h]!=n&&typeof e[h]!="function")f&&(b.dep=b.dep.length==0?h:b.dep+";"+h),g+=this.S(h,e[h]);f&&b.dep.length>0&&(g+=this.S("WT.dep",b.dep));d.da&&d.da<9&&g.length>2048&&(g=g.substring(0,2040)+"&WT.tu=1");this.Sa(g,a);this.d.ad=""}},rb:function(){this.fb();this.ab();this.P&&this.P.length>0&&this.Qa();this.sb=!0},getTime:function(){return(new Date).getTime()},jb:0,ya:function(a){for(var b=this.getTime();this.getTime()- +b0){a=a.toLowerCase();if(a==window.location.hostname.toLowerCase())return!0;if(d.g(b.test))return b.test(a);else if(b.length>0)for(var c=b.length,e=0;e0&&(f=f.replace(g,"$1")),d=f.search(a),d!=-1))d+=b,end=f.indexOf("&",d), +value=f.substring(d,end!=-1?end:f.length),this.d.ad=this.d.ad?this.d.ad+";"+value:value}}};d.b.prototype.action_multitrack=d.b.prototype.Ia;d.b.prototype.action_collect=d.b.prototype.Ha;i.dcsMultiTrack=function(){for(var a=[],b=0;b -
DCSIMG
- + // Webtrends specific. Taken from webtrends.load.js + $script .= << '404', + 'errorlink' => $_GET['q'], + ); + + drupal_goto($_GET['q'], $options); + } } From eb1f20addef547a21027d94997f4be18bf4a1810 Mon Sep 17 00:00:00 2001 From: Thomas Thune Hansen Date: Tue, 5 Aug 2014 08:26:09 +0200 Subject: [PATCH 2/2] Readded old js, for transition phase --- webtrends.admin.inc | 7 + webtrends.module | 35 +- webtrends.v9.3.0.js | 791 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 831 insertions(+), 2 deletions(-) create mode 100644 webtrends.v9.3.0.js diff --git a/webtrends.admin.inc b/webtrends.admin.inc index b09bbbe..c9817a4 100644 --- a/webtrends.admin.inc +++ b/webtrends.admin.inc @@ -21,6 +21,13 @@ function webtrends_admin_settings_form($form_state) { '#default_value' => variable_get('webtrends_dcs_id', FALSE), ); + $form['webtrends_old_dcs_id'] = array( + '#type' => 'textfield', + '#title' => t('Site ID'), + '#description' => t('The site identification key for the v9.3.0 js. Leave empty to disable v9.3.0.'), + '#default_value' => variable_get('webtrends_old_dcs_id', FALSE), + ); + $form['webtrends_error_pages'] = array( '#type' => 'checkbox', '#title' => t('Enable "Error pages" parameters'), diff --git a/webtrends.module b/webtrends.module index bd39ee4..548d32a 100644 --- a/webtrends.module +++ b/webtrends.module @@ -24,6 +24,7 @@ function webtrends_menu() { function webtrends_footer() { $domain = variable_get('webtrends_domain', FALSE); $dcs_id = variable_get('webtrends_dcs_id', FALSE); + $old_dcs_id = variable_get('webtrends_old_dcs_id', FALSE); $script_path = '/' . drupal_get_path('module', 'webtrends') . '/webtrends.min.js'; if (!$domain || !$dcs_id) { @@ -70,9 +71,39 @@ EOT; }()); EOT; - // We're relying on Drupal inserting inline js after references to - // external files. drupal_add_js($script, 'inline', 'footer'); + + // In the transition phase, the old js needs to be enabled aswell as the new. + if ($old_dcs_id) { + $script = << +
DCSIMG
+ +EOT; + + // We're relying on Drupal inserting inline js after references to + // external files. + drupal_add_js($script, 'inline', 'footer'); + drupal_add_js(drupal_get_path('module', 'webtrends') . '/webtrends.v9.3.0.js', 'module', 'footer'); + + return $html; + } } /** diff --git a/webtrends.v9.3.0.js b/webtrends.v9.3.0.js new file mode 100644 index 0000000..e2025e3 --- /dev/null +++ b/webtrends.v9.3.0.js @@ -0,0 +1,791 @@ +// WebTrends SmartSource Data Collector Tag +// Version: 9.3.0 +// Tag Builder Version: 3.1 +// Created: 1/10/2011 1:51:53 PM + +function WebTrends(){ + var that=this; + // begin: user modifiable + // this.dcsid="unconfigured"; + this.domain="visionize10.visionize.dk"; + this.timezone=1; + // this.fpcdom=".example.com"; + this.onsitedoms=""; + this.downloadtypes="arc,arj,ashx,avi,bin,dll,doc,docx,exe,gz,hqx,mp2,mp3,mp4,mpeg,mpg,pdf,pps,ppsx,ppt,pptx,rar,rpm,sit,svg,swf,tar,txt,wav,xls,xlsx,z,zip"; + this.navigationtag="div,table"; + this.adclickparam="WT.ac"; + this.trackevents=true; + this.trimoffsiteparams=true; + this.enabled=true; + this.i18n=false; + this.fpc="WT_FPC"; + this.paidsearchparams="gclid"; + this.splitvalue=""; + this.preserve=true; + // end: user modifiable + this.DCS={}; + this.WT={}; + this.DCSext={}; + this.images=[]; + this.index=0; + this.exre=(function(){return(window.RegExp?new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)","i"):"");})(); + this.re=(function(){return(window.RegExp?(that.i18n?{"%25":/\%/g,"%26":/\&/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}):"");})(); +} +WebTrends.prototype.dcsGetId=function(){ + if (this.enabled&&(document.cookie.indexOf(this.fpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){ + document.write("<\/scr"+"ipt>"); + } +} +WebTrends.prototype.dcsGetCookie=function(name){ + var cookies=document.cookie.split("; "); + var cmatch=[]; + var idx=0; + var i=0; + var namelen=name.length; + var clen=cookies.length; + for (i=0;i0){ + idx=0; + if ((cmatchCount>1)&&(name==this.fpc)){ + var dLatest=new Date(0); + for (i=0;idLatest){ + dLatest.setTime(dLst.getTime()); + idx=i; + } + } + } + return unescape(cmatch[idx].substring(namelen+1)); + } + else{ + return null; + } +} +WebTrends.prototype.dcsGetCrumb=function(cval,crumb,sep){ + var aCookie=cval.split(sep||":"); + for (var i=0;i(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){ + WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000); + dSes.setTime(dCur.getTime()); + WT.vt_f_s="1"; + } + if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){ + WT.vt_f_d="1"; + } + } + WT.co_f=escape(WT.co_f); + WT.vtid=(typeof(this.vtid)=="undefined")?WT.co_f:(this.vtid||""); + WT.vtvs=(dSes.getTime()-adj).toString(); + var expiry="; expires="+dExp.toGMTString(); + var cur=dCur.getTime().toString(); + var ses=dSes.getTime().toString(); + document.cookie=name+"="+"id="+WT.co_f+":lv="+cur+":ss="+ses+expiry+"; path=/"+(((this.fpcdom!=""))?("; domain="+this.fpcdom):("")); + var rc=this.dcsIsFpcSet(name,WT.co_f,cur,ses); + if (rc!=0){ + WT.co_f=WT.vtvs=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv=""; + if (typeof(this.vtid)=="undefined"){ + WT.vtid=""; + } + WT.vt_f=WT.vt_f_a=rc; + } +} +// Code section for Generate an Ad View query parameter for every Ad Click link. +WebTrends.prototype.dcsAdSearch=function(){ + if (document.links){ + var param=this.adclickparam+"="; + var paramlen=param.length; + var paramre=new RegExp(param,"i"); + var len=document.links.length; + var pos=end=-1; + var anch=urlp=value=""; + var urlpre; + var url=document.URL+""; + var start=url.search(paramre); + if (start!=-1){ + end=url.indexOf("&",start); + urlp=url.substring(start,(end!=-1)?end:url.length); + urlpre=new RegExp(urlp+"(&|#)","i"); + } + for (var i=0;i0){ + anch=anch.replace(urlpre,"$1"); + } + pos=anch.search(paramre); + if (pos!=-1){ + start=pos+paramlen; + end=anch.indexOf("&",start); + value=anch.substring(start,(end!=-1)?end:anch.length); + this.WT.ad=this.WT.ad?(this.WT.ad+";"+value):value; + } + } + } + } +} +WebTrends.prototype.dcsIsOnsite=function(host){ + if (host.length>0){ + host=host.toLowerCase(); + if (host==window.location.hostname.toLowerCase()){ + return true; + } + if (typeof(this.onsitedoms.test)=="function"){ + return this.onsitedoms.test(host); + } + else if (this.onsitedoms.length>0){ + var doms=this.dcsSplit(this.onsitedoms); + var len=doms.length; + for (var i=0;i0)&&(pr.indexOf("http")==0)&&!this.dcsIsOnsite(hn)){ + var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):""; + var pth=e.pathname?((e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname):"/"; + this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsuri", pth, "DCS.dcsqry", this.trimoffsiteparams ? "" : qry, "DCS.dcsref", window.location, "WT.ti", "Offsite:" + hn + pth + (qry.length ? ("?" + qry) : ""), "WT.dl", "24", "WT.nv", this.dcsNavigation(evt)); + } + } + } +} + +WebTrends.prototype.dcsAdv=function(){ + if (this.trackevents&&(typeof(this.dcsET)=="function")){ + if (window.addEventListener){ + window.addEventListener("load",this.dcsET.wtbind(this),false); + } + else if (window.attachEvent){ + window.attachEvent("onload",this.dcsET.wtbind(this)); + } + } + this.dcsFPC(); + this.dcsAdSearch(); +} +WebTrends.prototype.dcsVar=function(){ + var dCurrent=new Date(); + var WT=this.WT; + var DCS=this.DCS; + WT.tz=parseInt(dCurrent.getTimezoneOffset()/60*-1)||"0"; + WT.bh=dCurrent.getHours()||"0"; + WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage; + if (typeof(screen)=="object"){ + WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth; + WT.sr=screen.width+"x"+screen.height; + } + if (typeof(navigator.javaEnabled())=="boolean"){ + WT.jo=navigator.javaEnabled()?"Yes":"No"; + } + if (document.title){ + if (window.RegExp){ + var tire=new RegExp("^"+window.location.protocol+"//"+window.location.hostname+"\\s-\\s"); + WT.ti=document.title.replace(tire,""); + } + else{ + WT.ti=document.title; + } + } + WT.js="Yes"; + WT.jv=(function(){ + var agt=navigator.userAgent.toLowerCase(); + var major=parseInt(navigator.appVersion); + var mac=(agt.indexOf("mac")!=-1); + var ff=(agt.indexOf("firefox")!=-1); + var ff0=(agt.indexOf("firefox/0.")!=-1); + var ff10=(agt.indexOf("firefox/1.0")!=-1); + var ff15=(agt.indexOf("firefox/1.5")!=-1); + var ff20=(agt.indexOf("firefox/2.0")!=-1); + var ff3up=(ff&&!ff0&&!ff10&!ff15&!ff20); + var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1)); + var nn4=(nn&&(major==4)); + var nn6up=(nn&&(major>=5)); + var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1)); + var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1)); + var ie5up=(ie&&!ie4); + var op=(agt.indexOf("opera")!=-1); + var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1); + var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1); + var op7up=(op&&!op5&&!op6); + var jv="1.1"; + if (ff3up){ + jv="1.8"; + } + else if (ff20){ + jv="1.7"; + } + else if (ff15){ + jv="1.6"; + } + else if (ff0||ff10||nn6up||op7up){ + jv="1.5"; + } + else if ((mac&&ie5up)||op6){ + jv="1.4"; + } + else if (ie5up||nn4||op5){ + jv="1.3"; + } + else if (ie4){ + jv="1.2"; + } + return jv; + })(); + WT.ct="unknown"; + if (document.body&&document.body.addBehavior){ + try{ + document.body.addBehavior("#default#clientCaps"); + WT.ct=document.body.connectionType||"unknown"; + document.body.addBehavior("#default#homePage"); + WT.hp=document.body.isHomePage(location.href)?"1":"0"; + } + catch(e){ + } + } + if (document.all){ + WT.bs=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"unknown"; + } + else{ + WT.bs=window.innerWidth+"x"+window.innerHeight; + } + WT.fv=(function(){ + var i,flash; + if (window.ActiveXObject){ + for(i=15;i>0;i--){ + try{ + flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i); + return i+".0"; + } + catch(e){ + } + } + } + else if (navigator.plugins&&navigator.plugins.length){ + for (i=0;i0;i--){ + M=i; + if (Silverlight.isInstalled(M+".0")){ + break; + } + if (slv==M){ + break; + } + } + for (m=9;m>=0;m--){ + F=M+"."+m; + if (Silverlight.isInstalled(F)){ + slv=F; + break; + } + if (slv==F){ + break; + } + } + } + } + return slv; + })(); + if (this.i18n){ + if (typeof(document.defaultCharset)=="string"){ + WT.le=document.defaultCharset; + } + else if (typeof(document.characterSet)=="string"){ + WT.le=document.characterSet; + } + else{ + WT.le="unknown"; + } + } + WT.tv="9.3.0"; + WT.sp=this.splitvalue; + WT.dl="0"; + WT.ssl=(window.location.protocol.indexOf('https:')==0)?"1":"0"; + DCS.dcsdat=dCurrent.getTime(); + DCS.dcssip=window.location.hostname; + DCS.dcsuri=window.location.pathname; + WT.es=DCS.dcssip+DCS.dcsuri; + if (window.location.search){ + DCS.dcsqry=window.location.search; + } + if (DCS.dcsqry){ + var dcsqry=DCS.dcsqry.toLowerCase(); + var params=this.paidsearchparams.length?this.paidsearchparams.toLowerCase().split(","):[]; + for (var i=0;i'); + } +} +WebTrends.prototype.dcsMeta=function(){ + var elems; + if (document.documentElement){ + elems=document.getElementsByTagName("meta"); + } + else if (document.all){ + elems=document.all.tags("meta"); + } + if (typeof(elems)!="undefined"){ + var length=elems.length; + for (var i=0;i0){ + if (name.toUpperCase().indexOf("WT.")==0){ + this.WT[name.substring(3)]=content; + } + else if (name.toUpperCase().indexOf("DCSEXT.")==0){ + this.DCSext[name.substring(7)]=content; + } + else if (name.toUpperCase().indexOf("DCS.")==0){ + this.DCS[name.substring(4)]=content; + } + } + } + } +} +WebTrends.prototype.dcsTag=function(){ + if (document.cookie.indexOf("WTLOPTOUT=")!=-1){ + return; + } + var WT=this.WT; + var DCS=this.DCS; + var DCSext=this.DCSext; + var i18n=this.i18n; + var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+this.domain+(this.dcsid==""?'':'/'+this.dcsid)+"/dcs.gif?"; + if (i18n){ + WT.dep=""; + } + for (var N in DCS){ + if (DCS[N]&&(typeof DCS[N]!="function")){ + P+=this.dcsA(N,DCS[N]); + } + } + for (N in WT){ + if (WT[N]&&(typeof WT[N]!="function")){ + P+=this.dcsA("WT."+N,WT[N]); + } + } + for (N in DCSext){ + if (DCSext[N]&&(typeof DCSext[N]!="function")){ + if (i18n){ + WT.dep=(WT.dep.length==0)?N:(WT.dep+";"+N); + } + P+=this.dcsA(N,DCSext[N]); + } + } + if (i18n&&(WT.dep.length>0)){ + P+=this.dcsA("WT.dep",WT.dep); + } + if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){ + P=P.substring(0,2040)+"&WT.tu=1"; + } + this.dcsCreateImage(P); + this.WT.ad=""; +} +WebTrends.prototype.dcsDebug=function(){ + var t=this; + var i=t.images[0].src; + var q=i.indexOf("?"); + var r=i.substring(0,q).split("/"); + var m="Protocol
"+r[0]+"
"; + m+="Domain
"+r[2]+"
"; + m+="Path
/"+r[3]+"/"+r[4]+"
"; + m+="Query Params"+i.substring(q+1).replace(/\&/g,"
")+"
"; + m+="
Cookies
"+document.cookie.replace(/\;/g,"
")+"
"; + if (t.w&&!t.w.closed){ + t.w.close(); + } + t.w=window.open("","dcsDebug","width=500,height=650,scrollbars=yes,resizable=yes"); + t.w.document.write(m); + t.w.focus(); +} +WebTrends.prototype.dcsCollect=function(){ + if (this.enabled){ + this.dcsVar(); + this.dcsMeta(); + this.dcsAdv(); + if (typeof(this.dcsCustom)=="function"){ + this.dcsCustom(); + } + this.dcsTag(); + } +} + +function dcsMultiTrack(){ + if (typeof(_tag)!="undefined"){ + return(_tag.dcsMultiTrack()); + } +} + +function dcsDebug(){ + if (typeof(_tag)!="undefined"){ + return(_tag.dcsDebug()); + } +} + +Function.prototype.wtbind = function(obj){ + var method=this; + var temp=function(){ + return method.apply(obj,arguments); + }; + return temp; +} \ No newline at end of file