Permalink
Browse files

allow redacting query string params from urls before sending on the b…

…eacon
  • Loading branch information...
bluesmoon committed Oct 18, 2013
1 parent 035b7ea commit 0b84787b9a868b7dec89002ff7fb0661f6ffe540
Showing with 13 additions and 4 deletions.
  1. +11 −2 boomerang.js
  2. +2 −2 plugins/rt.js
View
@@ -65,6 +65,8 @@ impl = {
//! User's ip address determined on the server. Used for the BA cookie
user_ip: '',
+ strip_query_string: false,
+
onloadfired: false,
handlers_attached: false,
@@ -225,6 +227,13 @@ boomr = {
return this.setCookie(name, {}, 0);
},
+ cleanupURL: function(url) {
+ if(impl.strip_query_string) {
+ return url.replace(/\?.*/, '?qs-redacted');
+ }
+ return url;
+ },
+
pluginConfig: function(o, config, plugin_name, properties) {
var i, props=0;
@@ -261,7 +270,7 @@ boomr = {
init: function(config) {
var i, k,
- properties = ["beacon_url", "site_domain", "user_ip"];
+ properties = ["beacon_url", "site_domain", "user_ip", "strip_query_string"];
if(!config) {
config = {};
@@ -497,8 +506,8 @@ boomr = {
}
impl.vars.v = BOOMR.version;
- impl.vars.u = d.URL.replace(/#.*/, '');
// use d.URL instead of location.href because of a safari bug
+ impl.vars.u = BOOMR.utils.cleanupURL(d.URL.replace(/#.*/, ''));
if(w !== window) {
impl.vars["if"] = "";
}
View
@@ -421,10 +421,10 @@ BOOMR.plugins.RT = {
}
if(ntimers) {
- BOOMR.addVar("r", impl.r);
+ BOOMR.addVar("r", BOOMR.utils.cleanupURL(impl.r));
if(impl.r2 !== impl.r) {
- BOOMR.addVar("r2", impl.r2);
+ BOOMR.addVar("r2", BOOMR.utils.cleanupURL(impl.r2));
}
if(t_other.length) {

0 comments on commit 0b84787

Please sign in to comment.