Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Sanitize WJ/EW lead personal info from query string
- * after moving the values to local storage.
- * Run before recording Facebook events.
- * Author: Brian Katzung
- */
- (function () {
- var ls = location.search, params = [], reset = false;
- ls && ls.substring(1).split('&').forEach(function (param) {
- var parts = param.match(/([^=]+)=(.*)/);
- if (parts[1].match(/^wj_lead_/)) {
- localStorage.setItem(parts[1], decodeURIComponent(parts[2].replaceAll('+', ' ')));
- reset = true;
- } else {
- params.push(param);
- }
- });
- if (reset) {
- var newSearch = '?' + params.join('&');
- if (history.replaceState) history.replaceState(null, '', newSearch);
- else location.search = newSearch;
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement