From 6b0af81f71b56f8e62f587e4c0d066e7783d3a32 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 26 Apr 2018 12:22:56 +0100 Subject: [PATCH] For paths with variables, insert To preserve the analytics for these pages we did previously --- src/Analytics.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Analytics.js b/src/Analytics.js index d33358111a..e918530ba8 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -21,6 +21,7 @@ import Modal from './Modal'; import sdk from './index'; const hashRegex = /#\/(groups?|room|user|settings|register|login|forgot_password|home|directory)/; +const hashVarRegex = /#\/(group|room|user)\/.*$/; // Remove all but the first item in the hash path. Redact unexpected hashes. function getRedactedHash(hash) { @@ -31,6 +32,10 @@ function getRedactedHash(hash) { return '#/'; } + if (hashVarRegex.test(hash)) { + return hash.replace(hashVarRegex, "#/$1/"); + } + return hash.replace(hashRegex, "#/$1"); }