/*
Notes:
- Insert within normal BK code (before BKTAG.doTag(ENTER CONTAINER ID HERE, 4); function)
- Update 'qsp_whitelist' array to include any query-string params you want (logic will match any params begining with your value, e.g. 'utm_campaign' would match 'utm_' in whitelist)
*/
// whitelist params ("starts with") (add more params to this list)
qsp_whitelist = ["utm_"];
// Grab Query-String Parameters // grab from urlP["nameofparameter"], e.g. urlP["email_id"]
var urlP;
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function(s) {
return decodeURIComponent(s.replace(pl, " "));
},
query = window.location.search.substring(1);
urlP = {};
while (match = search.exec(query))
urlP[decode(match[1]).toLowerCase()] = decode(match[2]);
// query-string param grabber
for (qsp in urlP){
for (var i = 0; i < qsp_whitelist.length; i++) {
if (qsp.indexOf(qsp_whitelist[i]) === 0){
bk_addPageCtx('qsp_' + qsp, urlP[qsp]);
}
}
}