Created
September 11, 2012 17:30
-
-
Save jwalsh/3700061 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var defaults = { | |
bk_meta_vars: [], | |
bk_js_list: [], | |
bk_pixel_limit: 15, | |
bk_ignore_meta: true, | |
bk_allow_multiple_calls: false, | |
bk_ignore_outside_iframe: false | |
}; | |
for (var d in defaults) { | |
if (typeof window[d] === 'undefined') { | |
window[d] = defaults[d]; | |
} | |
} | |
var metaTags = document.getElementsByTagName('meta'); | |
function bk_metaKeywords(param) { | |
var ii = metaTags.length; | |
for (var i = 0; i < ii; i++) { | |
var tag = metaTags[i]; | |
if (tag.name == param) { | |
return tag.content; | |
} | |
} | |
return null; | |
} | |
var varMap = { | |
"bu": "v01", | |
"business_unit": "v02", | |
"CI_ItemIDs": "v03", | |
"CI_ItemNames": "v04", | |
"CI_ItemPrices": "v05", | |
"CI_ItemQtys": "v06", | |
"ci_transactionValue": "v07", | |
"description": "v08", | |
"gateway_page_title": "v09", | |
"language-code": "v10", | |
"language_code": "v10", | |
"lifecycle": "v11", | |
"lob": "v12", | |
"lpUASConversionTotal": "v13", | |
"lpUASsmbStorePurchaseMethod": "v14", | |
"lpUASsmbStoreShipToZip": "v15", | |
"page_content": "v16", | |
"PageTitle": "v17", | |
"pagetitle": "v18", | |
"PSC_Category": "v19", | |
"PSC_Family": "v20", | |
"publishURI": "v21", | |
"qs": "v22", | |
"seg": "v23", | |
"segment": "v24", | |
"simple_title": "v25", | |
"target_country": "v26", | |
"title": "v27", | |
"user_profile": "v28", | |
"user_type": "v29", | |
"wpn": "v30", | |
"__bk_t": "v31", | |
"pageLocation": "v32", | |
"ci_landing": "v33", | |
"ci_category": "v34", | |
"ci_series": "v35", | |
"ci_sku": "v36", | |
"ci_canparamNames": "v37", | |
"ci_canparamValues": "v38", | |
"ci_aoid": "v39", | |
"ci_catid": "v40", | |
"ci_cid": "v41", | |
"ci_itemid": "v42", | |
"ci_landinghp": "v43", | |
"ci_tid": "v44", | |
"CI_PaymentType": "v45", | |
"CI_ShipState": "v46", | |
"CI_ShipZip": "v47", | |
"ci_aIDs": "v48", | |
"ci_aItemNames": "v49", | |
"ci_aPrices": "v50", | |
"ci_aQtys": "v51", | |
"pageReferrer": "v52", | |
"CI_OrderID": "v53", | |
"ci_orderid": "v54", | |
"CI_ItemMfrs": "v55", | |
"web_section_id": "v56", | |
"CI_CartID": "v57", | |
"lpUASconversionStage": "v58", | |
"s_PageName": "v59", | |
"s_products": "v60", | |
"s_prop22": "v61" | |
}; | |
addParam('phint', "__bk_t", document.title); | |
addParam('phint', "pageLocation", document.location); | |
addParam('phint', "pageReferrer", document.referrer); | |
function addParam(type, k, v) { | |
if (varMap[k]) { | |
k = varMap[k]; | |
} | |
BKTAG.addParam(type, k, v); | |
} | |
var bk_skus = document.getElementsByName("ProductRef"); | |
var ii = bk_skus.length,val; | |
for (var i = 0; i<ii; i++) { | |
try { | |
addParam('phint', "sku", bk_skus[i].value.split("@")[0]); | |
} catch(err) {} | |
} | |
ii = bk_js_list.length; | |
for (i = 0; i < ii; i++) { | |
val = bk_js_list[i]; | |
if (typeof window[val] != 'undefined' && !!window[val] && window[val] !== '') { | |
addParam('phint', val, window[val]); | |
} | |
} | |
ii = bk_meta_vars.length; | |
for (i = 0; i < ii; i++) { | |
var metaVar = bk_meta_vars[i]; | |
val = bk_metaKeywords(metaVar); | |
if (!!val) { | |
addParam('phint', metaVar, val); | |
} | |
} | |
/* Exception Cases */ | |
var excludeFlag=false||(!!hpmmd.beacon_ignore); | |
if(!excludeFlag) { | |
BKTAG.doTag(bk_site_id, bk_pixel_limit, bk_ignore_meta, | |
bk_allow_multiple_calls, bk_ignore_outside_iframe); | |
} | |
})(); | |
if(typeof(_domReady)!="undefined") { | |
_domReady.ready(function() { doBKOnReady(); executeSendData(); }); | |
} | |
BKTAG.hpversion = version; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment