3 March 2020 | 6 minutes of reading time
Continue reading below
Get in touch with our experts for a free consultation and see how we can help you unlock the full potential of your data.
function(){ var piiRegex = [{ name: 'NON-WHITELISTED PARAMETER', regex: /([?&](?!((foo|bar)=))[^=]+=)([^&$#])+/gi, replacement: "$1[REDACTED]" },{ name: 'EMAIL', regex: /(([a-zA-Z0-9_\-\.]+)(@|%40)([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))/gi, replacement: "[REDACTED_EMAIL]" }]; return piiRegex; } |
function(){ return function(data, PII){ for (var i = 0; i < PII.length; i++){ data = data.replace(PII[i].regex, PII[i].replacement);};return data; } } |
function() { return function(model) {var piiRegex = {{PII}};var globalSendTaskName = '_' + model.get('trackingId') + '_sendHitTask';// Fetch reference to the original sendHitTaskvar originalSendTask = window[globalSendTaskName] = window[globalSendTaskName] || model.get('sendHitTask'); var i,j, hitPayload, parts, val; // Overwrite sendHitTask with PII purger model.set('sendHitTask', function(sendModel) { hitPayload = sendModel.get('hitPayload').split('&'); for (i = 0; i < hitPayload.length; i++) { parts = hitPayload[i].split('='); // Double-decode, to account for web server encode + analytics.js encode try { val = decodeURIComponent(decodeURIComponent(parts[1])); } catch(e) { val = decodeURIComponent(parts[1]); } piiRegex.forEach(function(pii){ val = {{return redactData function}}(val, piiRegex); }); parts[1] = encodeURIComponent(val); hitPayload[i] = parts.join('='); } sendModel.set('hitPayload', hitPayload.join('&'), true); originalSendTask(sendModel); }); }; } |
We provide custom solutions tailored to your organization at a great price. No huge projects with months of lead time, we deliver in weeks.