var sponsor=''; var project=''; var UAId=''; getServer(); var url=Right(document.location.pathname,document.location.pathname.length-1); var isdebug=false; //var UAId= "UA-7012908-6"; //var UAId= 'UA-7012908-7'; var pageTracker1; var pageTracker2; var callNum=0; document.write(''); function debug(msg) { if(!isdebug)return; try{ document.getElementById('debugGA').style.display=""; document.getElementById('debugGA').innerHTML=document.getElementById('debugGA').innerHTML +'
'+ msg+'
'; }catch(e){} } // Common JS code for Google Analytics. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); var trackPageviewURL = ''; var trackPageviews = []; function GoogletrackPageview() { this.trackPageviewFunctionName; this.trackPageviewFunctionValue; } function addtrackPageview(trackPageviewName, trackPageviewParameter) { obj = new GoogletrackPageview(); obj.trackPageviewFunctionName = trackPageviewName; obj.trackPageviewFunctionValue = trackPageviewParameter; var index = trackPageviews.length; trackPageviews[index] = obj; } function getServer() { var url=document.location.href; url=url.replace('http://', ''); url=url.replace('https://', ''); url=url.split('/')[0]; //alert(url); if(url.indexOf('studentedge')>=0) { project='se'; UAId='UA-5976669-1'; } if(url.indexOf('educationplanner')>=0) { project='aes'; UAId='UA-7012908-5'; } if(url.indexOf('collegequest')>=0) { project='cq'; UAId='UA-5340605-1'; } if(url.indexOf('petersons')>=0) { project='pcom'; UAId='UA-7012908-1'; } if(url.indexOf('petersons')>=0 && (sponsor!='2088'&& sponsor!='12894'&& sponsor!='1'&& sponsor!='0') ) { project='other'; UAId='UA-7012908-7'; } if(url.indexOf('pcombeta')>=0) { project='pcombeta'; UAId='UA-7012908-4'; } if(sponsor=='2088') { project='terc'; UAId='UA-7012908-3'; } if(sponsor=='12894') { project='dod'; UAId='UA-7012908-2'; } } function removeSpaces(string) { return string.split(' ').join(''); } function clean(str) { str=str.replace('&', 'and'); str=str.replace('/', '-'); return str.split(' ').join(''); } function checkMeta(MetaName){ var elems; if (document.all){ elems=document.all.tags("meta"); } else if (document.documentElement){ elems=document.getElementsByTagName("meta"); } if (typeof(elems)!="undefined"){ var length=elems.length; var i, content = ''; for (i=0;i0){ if (name == MetaName) { content=elems.item(i).content; break; } } } } if (content != '') return clean(content); else return "/"; } function Right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } function replaceMetas(trackUrl) { trackUrl=trackUrl.replace('DCSext.p_Category',checkMeta('DCSext.p_Category')); trackUrl=trackUrl.replace('DCSext.p_userid',checkMeta('DCSext.p_userid')); trackUrl=trackUrl.replace('DCSext.p_Sector',checkMeta('DCSext.p_Sector')); trackUrl=trackUrl.replace('DCSext.p_Group',checkMeta('DCSext.p_Group')); trackUrl=trackUrl.replace('WT.cg_n',checkMeta('WT.cg_n')); trackUrl=trackUrl.replace('WT.cg_s',checkMeta('WT.cg_s')); trackUrl=trackUrl.replace('DCSext.p_sponsor',checkMeta('DCSext.p_sponsor')); trackUrl=trackUrl.replace('dcsuri',url); return trackUrl.toLowerCase(); } function trackEvent(category,action) { pageTracker1._trackEvent(category, action, arguments[2], arguments[3]); debug('UAId='+pageTracker1.s); debug('event category='+category+''); debug('event action='+action+''); debug('event label='+arguments[2]+''); debug('event value='+arguments[3]+''); pageTracker2._trackEvent(category, action, arguments[2], arguments[3]); debug('UAId='+pageTracker2.s); debug('event category='+category+''); debug('event action='+action+''); debug('event label='+arguments[2]+''); debug('event value='+arguments[3]+''); } function getTracker(UAId) { var pageTracker = _gat._getTracker(UAId); var GAfunctions = trackPageviews; var callFunction; // execute addtional GA function assigned from caller. for (x in GAfunctions) { callFunction = eval(GAfunctions[x].trackPageviewFunctionName); callFunction(GAfunctions[x].trackPageviewFunctionValue) } // Below code will accept every traffic in any domain under the same UA id, even if GA profile configured with specific domain //pageTracker._setDomainName("none"); pageTracker._setAllowHash(false); pageTracker._setAllowLinker(true); // These codes are for tracking Campaign Traffic. Witout this code compaign won't be tracked. pageTracker._setCampNameKey("adcamp"); // name pageTracker._setCampMediumKey("admed"); // medium pageTracker._setCampSourceKey("adsrc"); // source pageTracker._setCampTermKey("adkwd"); // term/keyword pageTracker._setCampContentKey("adver"); // content return pageTracker; } function addTrans(orderId, affiliation, total, tax, shipping, city, state, country) { pageTracker1._addTrans(orderId, affiliation, total, tax, shipping, city, state, country); debug('UAId='+pageTracker1.s); debug('addTrans orderId='+orderId+''); debug('addTrans affiliation='+affiliation+''); debug('addTrans total='+total+''); debug('addTrans tax='+tax+''); debug('addTrans shipping='+shipping+''); debug('addTrans city='+city+''); debug('addTrans state='+state+''); debug('addTrans country='+country+''); pageTracker2._addTrans(orderId, affiliation, total, tax, shipping, city, state, country); debug('UAId='+pageTracker2.s); debug('addTrans tracked twice'); } function addTrans(orderId, affiliation, total, tax, shipping, city, state, country) { pageTracker1._addTrans(orderId, affiliation, total, tax, shipping, city, state, country); debug('UAId='+pageTracker1.s); debug('addTrans orderId='+orderId+''); debug('addTrans affiliation='+affiliation+''); debug('addTrans total='+total+''); debug('addTrans tax='+tax+''); debug('addTrans shipping='+shipping+''); debug('addTrans city='+city+''); debug('addTrans state='+state+''); debug('addTrans country='+country+''); pageTracker2._addTrans(orderId, affiliation, total, tax, shipping, city, state, country); debug('UAId='+pageTracker2.s); debug('addTrans tracked twice'); } function addItem(orderId, sku, name, category, price, quantity) { pageTracker1._addItem(orderId, sku, name, category, price, quantity); debug('UAId='+pageTracker1.s); debug('addItem orderId='+orderId+''); debug('addItem sku='+sku+''); debug('addItem name='+name+''); debug('addItem category='+category+''); debug('addItem price='+price+''); debug('addItem quantity='+quantity+''); pageTracker2._addItem(orderId, sku, name, category, price, quantity); debug('UAId='+pageTracker2.s); debug('addItem tracked twice'); } function trackTrans() { pageTracker1._trackTrans(); debug('UAId='+pageTracker1.s); pageTracker2._trackTrans(); debug('UAId='+pageTracker2.s); debug('trackTrans tracked twice'); } function uniqid() { var newDate = new Date; return newDate.getTime(); } function ecommerce(path,linktext,profilename,linkcost) { var id=uniqid(); track(path); addTrans(id,'',linkcost,'','','','',''); addItem(id,linktext,profilename,path,linkcost,1); trackTrans(); }