/* WSS Web Analytics (Web Side Story) Implementation *There is a fair amount of redundancy built into this code in order to accomodate schwabs new request to properly pass firmname/id and user id on nova sites and safely keep the same implementation on the rest of the SIM sites. Required: hbx.js must be included (***must be included after this file) which gives us acces to the function necessary for creating the required global hbx object Usage: var oWSS = new WSS(); - will setup the default values for required fields WSS.SetInput("pn","Stocks Research"); - set a value for a given input (see mapping below) WSS.SetAcctNumFromEnvironment("Production"); - since we have to determine environment server side, this makes for slightly cleaner code //Config Vars pndef = "Default Page Name ctdef = Default content Category //Action Settings fv = Form validation Minimum Elements or submit function name lt = Link Tracking dlf = Download filter dft = download file naming elf = exit link filter //Config vars seg = visitor segmentation fnl = funnels //Campaigns cmp = campaign ID cmpn = campaign ID in query dcmp = dynamic campaign id dcmpn = dynamic campaign id in query dcmpe = dynamic campaign expiration dcmpre = dynamic campaign response expiration hra = response attribute cmp = campaign id hqsr = response attribute in referral query hqsp = response attribute in query hlt = lead tracking gp = campaign goal gpn = campaign goal in query hcn = conversation attribute hcv = conversation value cp = legacy campaign cpd = campaign domain ci = customer ID hrf = custom referrer pec = error codes */ // non-editable section var _hbEC=0; _hbE=new Array; function _hbEvent(a,b){ b=_hbE[_hbEC++]=new Object(); b._N=a;b._C=0; return b; } var _hud="undefined"; function _II(a,b,c){return a.indexOf(b,c?c:0)} function _IL(a){return a!=_hud?a.length:0} function _IS(a,b,c){return b>_IL(a)?"":a.substring(b,c!=null?c:_IL(a))} function _RCV(a,b,c,d){ b=document.cookie; c=_II(b,a+"=");d=""; if(c>-1){ d=_II(b,";",c+1);d=(d>0)?d:_IL(b);d=(d>c)?_IS(b,c+_IL(a)+1,d):"" } return d } var hbx = _hbEvent("pv"); hbx.vpc = "HBX0100u"; //end non-editable section WSS = function() { try { //Set Default Vaules // required page variables hbx.gn = "ehg-charlesschwab.hitbox.com"; //cookie gateway name hbx.acct = "Account Number not Provided"; hbx.pn = "Page Name Not Provided"; hbx.mlc = "ImpactAwards"; // default page values hbx.ctdef = "full"; hbx.pndef = "title"; } catch(e){} } WSS.prototype.SetInput = function(sInputName, sInputValue) { try { hbx[sInputName] = sInputValue; this[sInputName] = sInputValue; } catch(e) {} try { if(hbx.mlc&&this.pn&&this.acct&&this.segment&&this.userid&&this.firmname&&hbx.gn) { populateHbxVariablesWithParms(hbx.mlc,this.pn,this.segment,this.userid,this.firmname,this.acct,hbx.gn); } } catch(e) {} } //a slightly cleaner way to update the account number which varies with environment WSS.prototype.SetAcctNumFromEnvironment = function(sEnvironment) { try { sEnvironment = sEnvironment.toLowerCase(); switch(sEnvironment) { case "development": case "acceptance": hbx.acct = "DM551219N7EF"; this.acct = "DM551219N7EF"; break; case "production": hbx.acct = "DM5509233FDF"; this.acct = "DM5509233FDF"; break; } } catch(e) {} } function populateHbxVariablesWithParms(category,pagename,segment,userid,firmname,accountno,gateway){ hbx.vpc="HBX0100u"; //BEGIN EDITABLE SECTION //CONFIGURATION VARIABLES hbx.pndef="title";//DEFAULT PAGE NAME hbx.ctdef="full";//DEFAULT CONTENT CATEGORY //OPTIONAL PAGE VARIABLES //ACTION SETTINGS hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME hbx.lt="auto";//LINK TRACKING hbx.dlf="n";//DOWNLOAD FILTER hbx.dft="n";//DOWNLOAD FILE NAMING hbx.elf="n";//EXIT LINK FILTER //CONFIGURATION VARIABLES hbx.seg="";//VISITOR SEGMENTATION hbx.fnl="";//FUNNELS //CAMPAIGNS hbx.cmp="";//CAMPAIGN ID hbx.cmpn="";//CAMPAIGN ID IN QUERY hbx.dcmp="";//DYNAMIC CAMPAIGN ID hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION hbx.hra="";//RESPONSE ATTRIBUTE hbx.cmp="";//CAMPAIGN ID hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY hbx.hlt="";//LEAD TRACKING hbx.gp="";//CAMPAIGN GOAL hbx.gpn="";//CAMPAIGN GOAL IN QUERY hbx.hcn="";//CONVERSION ATTRIBUTE hbx.hcv="";//CONVERSION VALUE hbx.cp="null";//LEGACY CAMPAIGN hbx.cpd="";//CAMPAIGN DOMAIN hbx.ci="";//CUSTOMER ID hbx.hrf="";//CUSTOM REFERRER hbx.pec="";//ERROR CODES hbx.pn=pagename;//PAGE NAME(S) //CATEGORIES hbx.mlc=category;//MULTI-LEVEL CONTENT CATEGORY hbx.acct=accountno; hbx.gn=gateway; hbx.hc1=hbxStrip(userid); hbx.hc2=hbxStrip(segment +'|' + firmname); hbx.hc3=hbxStrip(firmname +'|' + userid); hbx.hc4=hbxStrip(segment +'|' + userid); var cv=_hbEvent('cv'); cv.c5=hbxStrip(firmname +'|'+ segment); cv.c6=hbxStrip(firmname +'|'+ category +'/'+ pagename); cv.c7=hbxStrip(segment +'|'+ category +'/'+ pagename); cv.c8=hbxStrip(userid +'|' + category +'/'+ pagename); } function hbxStrip(a) { a = a.split(",").join(""); a = a.split("&").join(""); a = a.split("'").join(""); a = a.split("#").join(""); a = a.split("$").join(""); a = a.split("%").join(""); a = a.split("^").join(""); a = a.split("*").join(""); a = a.split(":").join(""); a = a.split("~").join(""); a = a.split(";").join(""); a = a.split(" ").join("+"); return a; }