⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hplabsmetrics.js

📁 关于内存管理中garbage collection机制的讨论
💻 JS
📖 第 1 页 / 共 2 页
字号:
/* HP Production Code - Release G.7.20050110a */
/* HP Control Variables */
var s_hp_enableMetaTagCode = true;  // Pulls s_prop7-10 from meta tags if true and if s_prop7-9 are not already set.
var s_hp_optOut = false // WARNING: IF SET TO TRUE, PAGE WILL NOT BE TRACKED

/* Standard SiteCatalyst Variables */
var s_disableLegacyVars=true
/* Specify the Report Suite ID(s) to track here */
var s_account="hphqglobal,hphqwwhplabs"
/* Dynamic Accounts - note these accounts will not show up in s_account */
var s_dynamicAccountSelection=false
var s_dynamicAccountList="devhphqtestaccount=localhost,127.0.0.1"
var s_dynamicAccountMatch=window.location.hostname + window.location.pathname
/* Link Tracking Config */
var s_trackDownloadLinks=true
var s_trackExternalLinks=true
var s_trackInlineStats=true
var s_linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,doc,pdf,xls,cgi,dot,pot,ppt,wmv,asx"
var s_linkInternalFilters="hp,compaq,cpqcorp,javascript:"
var s_linkLeaveQueryString=true
var s_linkTrackVars="None"
var s_linkTrackEvents="None"
/* Plugin Config */
var s_usePlugins=true
function s_doPlugins() {
/******MTX Click Capture utility - captures links from MTX section of block**/
	s_hp_captureMTXClicks();

/******eCommerce Jumpid and Jumpid Pathing Plug-in - remove slashes to use**/
/* Populates s_eVar15-20, s_prop2, and s_prop4 with JumpID information */
	s_hp_jumpIdProcessing()  
}

/************************** PLUGINS SECTION *************************/
/* You may insert any plugins you wish to use here.                 */
/*
 * Plugin: Get Plugin Modified Value
 */
function s_vp_getValue(vs)
	{var k=vs.substring(0,2)=='s_'?vs.substring(2):vs;return s_wd[
	's_vpm_'+k]?s_wd['s_vpv_'+k]:s_gg(k)}
/*
 * Plugin: Get Query String CGI Variable Value
 */
function s_vp_getCGI(vs,k)
	{var v='';if(k&&s_wd.location.search){var q=s_wd.location.search,
	qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s_pt(q,'&',s_cgif,
	k)}s_vpr(vs,v)}function s_cgif(t,k){if(t){var te=t.indexOf('='),
	sk=te<0?t:t.substring(0,te),sv=te<0?'True':t.substring(te+1);if(
	sk==k)return s_epa(sv)}return ''}
/* Macro based on getCGI and getValue
*/
function s_vp_getCGIValue(vs,k) {
	s_vp_getCGI(vs,k);
	return s_vp_getValue(vs);
}
/*
 * Plugin: Set variable to value only once per time priod:
 *         (Min, Hour, Day, Month, Year)
 *         in the specified timezone (hour offset from GMT)
 */
function s_vp_setOncePer(vs,v,period,tzOffs)
	{if(v){var n=s_dt(tzOffs,0),t,st=s_vh_gt(vs,v);st=st?st:0;if(
	!s_vh_s(vs,v))v='';else if(st){t=s_dt(tzOffs,st);var min=(
	n.getMinutes()==t.getMinutes()),hour=(n.getHours()==t.getHours()
	),day=(n.getDate()==t.getDate()),mon=(n.getMonth()==t.getMonth()
	),year=(n.getYear()==t.getYear());if(period=='Ever'||(year&&((
	period=='Year')||(mon&&((period=='Month')||(day&&((period=='Day'
	)||(hour&&((period=='Hour')||(min&&period=='Min')))))))))){v=''}}
	}s_vpr(vs,v)}
/*
 * Plugin: MTX Message Tracking Plug-in
 * Pull mtxs,mtxb,mtxl, and mtxc query string parameters from the URL and 
 * place the contactenated values in s_prop11.  No values returned.  Depends on
 * SiteCatalyst getCGI values
 */
var s_prop11,s_eVar19,s_eVar20;
function s_hp_captureMTXClicks() {
	hp_date = new Date();
	t_date = (hp_date.getYear()+1900)*10000 + (hp_date.getMonth()+1)*100 + hp_date.getDate();
	t_variable0=s_wd.location.href;
	s_vp_getCGI('t_variable1','mtxs');mtxs=s_vp_getValue("t_variable1");
	s_vp_getCGI('t_variable2','mtxb');mtxb=s_vp_getValue("t_variable2");
	s_vp_getCGI('t_variable3','mtxl');mtxl=s_vp_getValue("t_variable3")
	s_vp_getCGI('t_variable4','mtxc');mtxc=s_vp_getValue("t_variable4")
	s_vp_getCGI('t_variable5','mtxe');mtxe=s_vp_getValue("t_variable5")
	if(mtxc.length>0) {mtxc+= "/";}
	else {mtxc=""}
	if(( mtxe <= 0 || (mtxe>0 && mtxe>t_date)) && (mtxs.length>0||mtxb.length>0||mtxl.length>0 && !(window.s_prop11 && s_prop11.length>0)) ){
		s_prop11=mtxc+s_vp_getValue("t_variable1")+'|'+s_vp_getValue("t_variable2")+'|'+s_vp_getValue("t_variable3")+'|'+t_variable0;
		s_eVar19 = s_prop11
		s_eVar20 = s_prop11
	}  
}
/*
 * Plugin: eCommerce / JumpID Tracking Plug-in
 * Capture the jumpID / eVar settings in s_prop2, s_prop4, and s_eVar15-20
 * prop2 contains just the jumpid, prop4 contains the jumpid path,
 * Depends on s_vp_getCGI
 */
var s_prop2,s_prop4,s_eVar15,s_eVar16,s_eVar17,s_eVar18,s_eVar19,s_eVar20;
function s_hp_jumpIdProcessing() {
	s_vp_getCGI('t_variable1','jumpid');
	s_prop2=s_vp_getValue("t_variable1").toLowerCase();
	if(s_prop2 && s_prop2.length>0) {
		s_eVar20 = s_prop2;
		s_prop4 = s_prop2 + "|" + window.location.href.toLowerCase().substring(0,100);
		s_jumpIdType = s_prop2.substring(0,3);
		if (s_jumpIdType.indexOf('ex_') > -1){   
    		s_eVar15 = s_eVar20;
		}else if (s_jumpIdType.indexOf('in_') > -1){
    		s_eVar16 = s_eVar20;
		}else if (s_jumpIdType.indexOf('em_') > -1){
    		s_eVar17 = s_eVar20;
		}else if (s_jumpIdType.indexOf('re_') > -1){
    		s_eVar18 = s_eVar20;
		}else{
    		s_eVar19 = s_eVar20;
		} 
	}
}
/*
 * Plugin: Fix product String
 * Strips out non-numeric values from quantity and price sections of 
 * s_products string.  The enforceValidAlphaProductString flag will
 * turn on additional filtering that will remove non-alpha characters
 * from the remainder of the s_products string.
 */
function s_hp_fixProductString() {
	s_hp_enforceValidAlphaProductString = false;
	if(window.s_products && s_products.length>0) { // If s_products exists
		var h_prdarray1 = window.s_products.split(",");
		var i,j,k;
		for(i=0;i<h_prdarray1.length;i++) {
			h_prdarray2 = h_prdarray1[i].split(";");
			for(j=0;j<h_prdarray2.length;j++) {				
				if(s_hp_enforceValidAlphaProductString && (j==0||j==1)) { // First and Second: Strip out non alpha chars
					h_newValue="";
					for(k=0;k<h_prdarray2[j].length;k++) {
						if(h_isValidAlphaNumeric(h_prdarray2[j].substring(k,k+1)))
							h_newValue += h_prdarray2[j].substring(k,k+1);
					}
					h_prdarray2[j]=h_newValue;
				}
				if(j==2 || j == 3) { // First and Second: Strip out non alpha chars
					h_newValue="";
					for(k=0;k<h_prdarray2[j].length;k++) {
						if(h_isNumeric(h_prdarray2[j].substring(k,k+1)))
							h_newValue += h_prdarray2[j].substring(k,k+1);
					}
					h_prdarray2[j]=h_newValue;				
				}
			}
			h_prdarray1[i]=h_prdarray2.join(";")
		}
		window.s_products = h_prdarray1.join(",")
	}
}
function h_isNumeric(test) { var valid = "0123456789."; if(valid.indexOf(test)!= -1) return true;
return false; }
function h_isValidAlphaNumeric(test) { 
var valid = "abcdefghijklmnopqrstuvwxyz _-+={}[]|\/?:;\"'<>,.~`!@#$%^&*()";
if(h_isNumeric(test) || !(valid.indexOf(test)==-1 && 
valid.toUpperCase().indexOf(test)==-1)) return true;
return false; }
/*
 * Plugin: Remove Report Suite Name from Account List
 * Removes a report suite ID from the s_account variable list.  This ensures that certain
 * deprecated report suite IDs will be removed from SiteCatalyst-enabled pages
 */
function s_hp_removeRSName(acct_to_remove) {
	acct_to_remove=acct_to_remove.toLowerCase();
	s_account = s_account.toLowerCase();
	if(window.s_account && s_account.indexOf(acct_to_remove)!= -1) {
		var s_hp_tmpa = s_account.split(",");s_hp_new_acct="";
		for(i=0;i<s_hp_tmpa.length;i++) {
			if(s_hp_tmpa[i].indexOf(acct_to_remove)== -1) s_hp_new_acct+=s_hp_tmpa[i] + ",";
		}
		s_account = s_hp_new_acct.substring(0,s_hp_new_acct.length-1);
	}
}
/* MetaTag code, V2.0 */
function s_hp_scrapeMetaTags() {
   	if (document.getElementsByTagName){
		t_lang = window.document.documentElement.lang
		if(!(window.s_prop8 && s_prop8.length>0)) eval("s_prop8=\"" + t_lang + "\"")
		var allMyStuff=document.getElementsByTagName("META");
		var myMeta;var myVariableNames;
		var myVariableMap = new Array();
		if(!(window.s_prop7 && s_prop7.length>0)) myVariableMap["target_country"] = "s_prop7"; 
		if(!(window.s_prop9 && s_prop9.length>0)) myVariableMap["segment"] = "s_prop9";
		for (var i=0; i<allMyStuff.length; i++){
		if (allMyStuff[i].tagName == "META"){
			myMeta = allMyStuff[i];
				if (myVariableMap[myMeta.name] != null){
					eval(myVariableMap[myMeta.name] + " ='"+ myMeta.content.toLowerCase().split("'").join("") +"'");
					}
				else{
					myContent = myMeta.content.toLowerCase();
					if(myContent.indexOf("charset")!= -1 && !(window.s_charSet && s_charSet.lenght>0)) {
						myCharSetArray = myContent.split("rset=");
						eval("s_charSet=\"" + myCharSetArray[1].toUpperCase()+"\"");
					} else {
						eval("s_" + myMeta.name + " = '"+ myContent.split("'").join("") +"'");
					}
				}
			}
		}
	}
	eval("if(!(window.s_prop7 && s_prop7.length>0)) s_prop7=\"undef\";")
	eval("if(!(window.s_prop8 && s_prop8.length>0)) s_prop8=\"undef\";")
	eval("if(!(window.s_prop9 && s_prop9.length>0)) s_prop9=\"undef\";")
} // End function
/*
 * Plugin Utilities v2.0 (Required For All Plugins)
 */
function s_vpr(vs,v){if(s_wd[vs])s_wd[vs]=s_wd[vs];else s_wd[vs]=''
if(vs.substring(0,2) == 's_')vs=vs.substring(2);s_wd['s_vpv_'+vs]=v
s_wd['s_vpm_'+vs]=1}function s_dt(tz,t){var d=new Date;if(t)d.setTime(
t);d=new Date(d.getTime()+(d.getTimezoneOffset()*60*1000))
return new Date(Math.floor(d.getTime()+(tz*60*60*1000)))}
function s_vh_gt(k,v){var vh='|'+s_c_r('s_vh_'+k),vi=vh.indexOf('|'+v
+'='),ti=vi<0?vi:vi+2+v.length,pi=vh.indexOf('|',ti),t=ti<0?'':
vh.substring(ti,pi<0?vh.length:pi);return t}function s_vh_gl(k){var
vh=s_c_r('s_vh_'+k),e=vh?vh.indexOf('='):0;return vh?(vh.substring(0,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -