1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-05 09:10:53 +01:00

stip guids from analytics page paths

This commit is contained in:
Kyle Spearrin 2018-07-18 13:12:48 -04:00
parent aa811e51c3
commit 257b1d7d7a

View File

@ -104,6 +104,15 @@ export class Analytics {
if (pagePath.indexOf('!/') === 0 || pagePath.indexOf('#/') === 0) {
pagePath = pagePath.substring(1);
}
return encodeURIComponent(pagePath);
const pathParts = pagePath.split('/');
const newPathParts: string[] = [];
pathParts.forEach((p) => {
if (p.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)) {
newPathParts.push('__guid__');
} else {
newPathParts.push(p);
}
});
return encodeURIComponent(newPathParts.join('/'));
}
}