var gImages=new Array; // Array to hold images so they don't show up on the page var gIndex=0; // Index for current image var DCS=new Object(); // The DCS object holds parameters to override fields in the SDC weblog var WT=new Object(); // The WT object holds parameters used in custom reporting var DCSext=new Object(); // The DCSext object holds site specific parameters var gQP=new Array(); // Array of desired query parameters to pass to WebTrends var gI18n=true; if (window.RegExp){ var RE={"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g}; var I18NRE={"%25":/\%/g}; } var HSBC = new Object(); // THw HSBC parameter holds five subgroups of parameters defined on a per site basis HSBC.SITE = new Object(); // SITE specific variables go into this object. They are translated to DCSext vairables HSBC.PAGE = new Object(); // WT Overrides --portal variables that need to overrride WT variables go into this object HSBC.EXT = new Object(); // This is a placeholder for non SITE oriented DCSext variables HSBC.LOG = new Object(); // DCS overrides -- Variables in here will override DCS.* variables matching the name HSBC.DCS = new Object(); // This object contains HSBC.DCS.ID with the dcsid and HSBC.DCS.Doms with the comma-separated // list of domains to be considered on-site. As it currently stands, these domains have // to be complete domain names. HSBC.SITE.tagversion = "4.1"; // List all the live domains the group has (per GeB) to make sure they are not included as an off-site link // // MAKE SURE YOU ADD YOUR OWN WEBSITE DOMAINS TO THIS LIST // HSBC.DCS.Doms="sc.hangseng.com,www.hangseng.com,130.20.86.196"; // This is where the information collected by the WT Tracklet be sent var gDomain="www1.member-hsbc-group.com"; // The gDcsId will be assigned from the HSBC.DCS.ID variable var gDcsId="dcs8a9pzfvievvfhkn6u3og9d_5u3o"; // GLOBAL DCS ID... // This is the code to handle the impressions for the onsite Ad campaigns function dcsAdSearch(){ if (document.links){ for (var i=0;i0) ) { for (var i =0;i < document.links.length;i++) { if (document.links[i].addEventListener){ document.links[i].addEventListener(event, window[func], true); } else if(document.links[i].attachEvent){ document.links[i].attachEvent("on"+event, window[func]); } } } } } // This functions defines the events of intgerest and the functions associated with them. // In this example, we're only interested in offsite links function dcsET(){ dcsBind("click","dcsDownload"); dcsBind("click","dcsOffsite"); dcsBind("mousedown","dcsRightClick"); } // Track clicks to download links. function dcsDownload(evt){ evt=evt||(window.event||""); if (evt){ var e=dcsEvt(evt); if (dcsIsHttp(e)&&dcsIsOnsite(e.hostname)){ var types="xls,doc,pdf,txt,csv,zip"; //customize download types if (types.indexOf(e.pathname.substring(e.pathname.lastIndexOf(".")+1,e.pathname.length))!=-1){ var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):""; if (qry.toUpperCase().indexOf("WT.SVL=")==-1){ WT.svl=dcsParseSvl(e.name?e.name.toString():(e.onclick?e.onclick.toString():"")); } var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname; dcsMultiTrack("DCS.dcssip",e.hostname,"DCS.dcsuri",path,"WT.ti","Download:"+path,"WT.dl","1"); DCS.dcssip=DCS.dcsuri=WT.ti=WT.svl=WT.dl=""; } } } } // Track right clicks to download links. function dcsRightClick(evt){ evt=evt||(window.event||""); if (evt){ var btn=evt.which||evt.button; if (btn!=1){ var e=evt.target||evt.srcElement; if (dcsIsHttp(e)){ var types="xls,doc,pdf,txt,csv,zip"; //customize download types if (types.indexOf(e.pathname.substring(e.pathname.lastIndexOf(".")+1,e.pathname.length))!=-1){ var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname; dcsMultiTrack("DCS.dcssip",e.hostname,"DCS.dcsuri",path,"DCS.dcsqry","","WT.ti","Download:"+path,"WT.dl","1","WT.rc","1"); DCS.dcssip=DCS.dcsuri=WT.ti=WT.dl=WT.rc=""; } } } } } // Code section for Track clicks to links leading offsite. function dcsOffsite(evt){ evt=evt||(window.event||""); if (evt){ var e=dcsEvt(evt); if (dcsIsHttp(e)&&!dcsIsOnsite(e.hostname)){ var qry=e.search?e.search.substring(e.search.indexOf("?")+1,e.search.length):""; if (qry.toUpperCase().indexOf("WT.SVL=")==-1){ WT.svl=dcsParseSvl(e.name?e.name.toString():(e.onclick?e.onclick.toString():"")); } var path=(e.pathname.indexOf("/")!=0)?"/"+e.pathname:e.pathname; var trim=true; dcsMultiTrack("DCS.dcssip",e.hostname,"DCS.dcsuri",path,"DCS.dcsqry",trim?"":qry,"WT.ti","Offsite:"+e.hostname+path+qry,"WT.os","1","DCS.dcsref",window.location.hostname); DCS.dcssip=DCS.dcsuri=DCS.dcsqry=WT.ti=WT.svl=WT.os=DCS.dcsref=""; } } } // Assign your query parameters to WebTrends query parameters. function dcsQP(N){ if (!N){ return; } var qry=location.search.substring(1); var pairs=qry.split("&"); for (var i=0;i // // // var gService = true; var gTimeZone = 0; // Code section for Enable First-Party Cookie Tracking function dcsCookie(){ if (typeof(dcsOther)=="function"){ dcsOther(); } else if (typeof(dcsPlugin)=="function"){ dcsPlugin(); } else if (typeof(dcsFPC)=="function"){ dcsFPC(gTimeZone); } } function dcsGetCookie(name){ var pos=document.cookie.indexOf(name+"="); if (pos!=-1){ var start=pos+name.length+1; var end=document.cookie.indexOf(";",start); if (end==-1){ end=document.cookie.length; } return unescape(document.cookie.substring(start,end)); } return null; } function dcsGetCrumb(name,crumb){ var aCookie=dcsGetCookie(name).split(":"); for (var i=0;i(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){ 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"; } } else{ var tmpname=name+"_TMP="; document.cookie=tmpname+"1"; if (document.cookie.indexOf(tmpname)!=-1){ document.cookie=tmpname+"; expires=Thu, 01-Jan-1970 00:00:01 GMT"; if ((typeof(gWtId)!="undefined")&&(gWtId!="")){ WT.co_f=gWtId; } else if ((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){ WT.co_f=gTempWtId; WT.vt_f="1"; } else{ WT.co_f="2"; var cur=dCur.getTime().toString(); for (var i=2;i<=(32-cur.length);i++){ WT.co_f+=Math.floor(Math.random()*16.0).toString(16); } WT.co_f+=cur; WT.vt_f="1"; } if (typeof(gWtAccountRollup)=="undefined"){ WT.vt_f_a="1"; } WT.vt_f_s="1"; WT.vt_f_d="1"; } else{ WT.vt_f="2"; WT.vt_f_a="2"; return; } } WT.co_f=escape(WT.co_f); WT.vt_sid=WT.co_f+"."+dSes.getTime(); var expiry="; expires="+dExp.toGMTString(); document.cookie=name+"="+"id="+WT.co_f+":lv="+dCur.getTime().toString()+":ss="+dSes.getTime().toString()+expiry+"; path=/"+(((typeof(gFpcDom)!="undefined")&&(gFpcDom!=""))?("; domain="+gFpcDom):("")); } // Code section for Use the new first-party cookie generated with this tag. var gFpc="WT_FPC"; var gWtId=""; var gTempWtId=""; var gConvert=true; // Code section for Set the First-Party Cookie domain var gFpcDom=""; // // If we need to convert an old SDC cookie, this code will pull the old cookie from the sdc server // if ((typeof(gConvert)!="undefined")&&gConvert&&(document.cookie.indexOf(gFpc+"=")==-1)){ document.write(""); } function dcsAdv(){ dcsFunc("dcsAdSearch"); dcsFunc("dcsCookie"); dcsFunc("dcsET"); } function dcsFunc(func){ if (typeof(window[func])=="function"){ window[func](); } } // dcsMultiTrack is called with pairs of parameters as // text strings that use the JavaScript variable to be // overridded and the value to override. For example, // in an onClick function downloading a PDF: // onClick="dcsMultiTrack('DCS.dcsuri','this.pdf')" function dcsMultiTrack(){ for (var i=0;i3){ if ((navigator.appName=="Microsoft Internet Explorer")&&document.body){ WT.bs=document.body.offsetWidth+"x"+document.body.offsetHeight; } else if (navigator.appName=="Netscape"){ WT.bs=window.innerWidth+"x"+window.innerHeight; } } WT.fi="No"; if (window.ActiveXObject){ var maxVer=10; var minVer=2; for (var ver=minVer;ver<=maxVer;ver++){ try{ var oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ver+"');"); if (oFlash){ WT.fi="Yes"; WT.fv=ver+".0"; break; } } catch(e){ } } } else if (navigator.plugins&&navigator.plugins.length){ for (var i=0;i0){ for (var i=0;i'); } } // This function goes through all META tags on a page // and replaces WT, DCS and DCSext JavaScript variables // with the content of the META tags that match their names. // With this function you do not have to include or // modify JavaScript to change parameters used by // WebTrends reporting. function dcsMeta(){ var myDocumentElements; if (document.all){ myDocumentElements=document.all.tags("meta"); } else if (document.documentElement){ myDocumentElements=document.getElementsByTagName("meta"); } if (typeof(myDocumentElements)!="undefined"){ for (var i=1;i<=myDocumentElements.length;i++){ myMeta=myDocumentElements.item(i-1); if (myMeta.name){ if (myMeta.name.indexOf('WT.')==0){ WT[myMeta.name.substring(3)]=(gI18n&&(myMeta.name.indexOf('WT.ti')==0))?dcsEscape(dcsEncode(myMeta.content),I18NRE):myMeta.content; } else if (myMeta.name.indexOf('DCSext.')==0){ DCSext[myMeta.name.substring(7) ] =myMeta.content; }else if (myMeta.name.indexOf('DCS.')==0){ DCS[myMeta.name.substring(4)]=(gI18n&&(myMeta.name.indexOf('DCS.dcsref')==0))?dcsEscape(myMeta.content,I18NRE):myMeta.content; } } } } } //This function calls the appending function to create the // tag and dcsCreateImage to send it to the server. function dcsTag(){ if (document.cookie.indexOf("WTLOPTOUT=")!=-1){ return; } var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+(gDcsId==""?'':'/'+gDcsId)+"/dcs.gif?"; for (N in DCS){ if (DCS[N]) { P+=dcsA(N,DCS[N]); } } for (N in WT){ if (WT[N]) { P+=dcsA("WT."+N,WT[N]); } } for (N in DCSext){ if (DCSext[N]) { P+=dcsA(N,DCSext[N]); } } if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){ P=P.substring(0,2040)+"&WT.tu=1"; } dcsCreateImage(P); } // This function collects an HSBC cookie that otherwise would // not be available for tracking The desired cookie is // passed as a parameter and the cookie value returned. function dcsGetHSBCCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } // This function collects all the HSBC variables and translates // them into the appropriate WebTrends variabls (WT variables // from HSBC.PAGE, DCSext variables from SITE and EXT, and // DCS variables from HSBC.LOG variables. It also overrides // the value of gDcsId from the HSBC.DCS.ID variable. function dcsMapHSBC() { for (N in HSBC) { if (N == "SITE") { for (S in HSBC.SITE) { DCSext[S] = HSBC.SITE[S]; } } if (N == "PAGE") { for (S in HSBC.PAGE) { WT[S] = HSBC.PAGE[S]; } } if (N == "EXT") { for (S in HSBC.EXT) { DCSext[S] = HSBC.EXT[S]; } } if (N == "LOG") { for (S in HSBC.LOG) { DCS[S] = HSBC.LOG[S]; } } if (N == "DCS") { gDcsId = HSBC.DCS.ID; } } }