Skip to content

Instantly share code, notes, and snippets.

@thomasv314
Created January 13, 2012 17:31
Show Gist options
  • Save thomasv314/1607656 to your computer and use it in GitHub Desktop.
Save thomasv314/1607656 to your computer and use it in GitHub Desktop.
<script>
function readCookie(name){
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = cookie.substring(name.length + 1);
break;
}
}
}
return cookieValue;
}
var hc2 = 'none';
var c5 = 'none';
var isSpanishMode = false;
var isCsr = false;
var isMS = true;
var isPP = false;
var isValidSession = true;
var hasValidStoreMachineId = false;
if(isValidSession) {
hc2 = '222184237-00001';
c5 = '6096173794';
}
var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}
var hbx=_hbEvent("pv");
hbx.vpc="HBX0200u";
hbx.gn="www35.vzw.com";//HBX Server
//CONFIGURATION VARIABLES
if(isSpanishMode){
hbx.acct="DM570203L6VD;DM57013148FM";//HBX Account ID(s)
}else{
hbx.acct="DM561203JAVS;DM570203L6VD";//HBX Account ID(s)
}
hbx.lc="y";
hbx.ctdef="full";//DEFAULT CONTENT CATEGORY
//To check if the variable has value, if not assign blank value to avoid javascript error.
if(window.pageName === undefined){
pageName = "";
}
if(window.pageMLC === undefined){
pageMLC = "";
}
if(isMS) {
pageMLC = "/nah" + pageMLC;
}
if(isPP) {
pageMLC = "/prepay" + pageMLC;
}
if(isSpanishMode){
pageMLC = "/espanol" + pageMLC;
}
//Append /opal if the page is being accessed by Customer Rep/From Opal
if(isCsr){
pageMLC = "/opal" + pageMLC;
}
hbx.pn=_hbxStrip(pageName);//PAGE NAME(S)
/* Define content group: Content Groups are used to create a hierarchal structure of content on the website. Content groups usually follow the website?s main navigation and can consist of multiple levels (up to 8 levels deep). (refer to implementation guide for complete details). */
hbx.mlc=_hbxStrip(pageMLC);//MULTI-LEVEL CONTENT CATEGORY
hbx.seg="1,2";//VISITOR SEGMENTATION
//hbx.fnl="";//FUNNELS
// LINK
hbx.lt = "auto";
hbx.dlf = "!.do"
/*
Custom Variables : Custom metrics will allow us to analyze traffic in ways not easily tracked through
default HBX tracking. Please note that custom metrics 3 and 4 will not be used. My Account will use
Custom Metrics to pass the customer account number and mtn (if applicable):
*/
//hbx.hc2='222184237-00001';//Account Number
hbx.hc2 = hc2;
//MTN: Custom Metric 5 : The MTN should be passed into this ariable using the following nomenclature
var cv = _hbEvent("cv");
//cv.c5 = '6096173794';
cv.c5 = c5;
//Send csr userid in custom metric 19 for all the pages being accesesed from opal
if(isCsr){
cv.c19 = '';
//cv.c19 = c19;
}
//var globalIdVal = jQuery.cookie("GLOBALID"); CR 2810 5/16/11.. to remove the decode logic per CAM, CIS.. added below custom logic
var globalIdVal = readCookie("GLOBALID");
cv.c34 = globalIdVal;
//Error Msg: Custom Metric 6 : The Error Message should be passed into this ariable using the following nomenclature
//To check if the variable has value, if not assign blank value to avoid javascript error.
if(window.hbxErrorMsg === undefined){
//dont pass errr msg
}else{
cv.c6 = hbxErrorMsg;
}
function _hbLinkClick(lid,position){
var linkID = _hbxStrip(lid);
_hbLink(linkID.toLowerCase(),position);
}
function _hbLinkClick(lid){
var linkID = _hbxStrip(lid);
_hbLink(linkID.toLowerCase(),'');
}
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("");
a = a.split("~").join("");
a = a.split(";").join("");
a = a.split("?").join("");
a = a.split("?").join("");
a = a.split(" ").join("+");
return a;
}
function _vzwHbPageView(pn, pmlc){
if(pn == '' && pmlc == ''){
return;
}
if(isMS) {
pmlc = "/nah" + pmlc;
}
if(isPP) {
pmlc = "/prepay" + pmlc;
}
if(isSpanishMode){
pmlc = "/espanol" + pmlc;
}
//Append /opal if the page is being accessed by Customer Rep/From Opal
if(isCsr){
pmlc = "/opal" + pmlc;
}
_hbPageView(pn,pmlc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment