From 56df54f9460393b5c8551c1c5432f141199a36d6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 7 Jun 2017 11:17:57 +0100 Subject: [PATCH 1/3] hardcode logged url to riot.im/app so piwik has a base to work with, it gets confused when a CustomURL isn't actually a URL (like it wasn't after the latest redaction fixes. Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Analytics.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index c079011db7..fcedf43ab9 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -20,9 +20,9 @@ import PlatformPeg from './PlatformPeg'; import SdkConfig from './SdkConfig'; function getRedactedUrl() { - const base = window.location.pathname.split('/').slice(-2).join('/'); const redactedHash = window.location.hash.replace(/#\/(room|user)\/(.+)/, "#/$1/"); - return base + redactedHash; + // hardcoded url to make piwik happy + return 'https://riot.im/app/' + redactedHash; } const customVariables = { From bd948ef91534f8e62714fae65a6a967190dcea6d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 7 Jun 2017 11:25:27 +0100 Subject: [PATCH 2/3] for riot.im instances, track location.pathname Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Analytics.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Analytics.js b/src/Analytics.js index fcedf43ab9..b9f969973e 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -30,6 +30,7 @@ const customVariables = { 'App Version': 2, 'User Type': 3, 'Chosen Language': 4, + 'Instance': 5, }; @@ -86,6 +87,10 @@ class Analytics { this._setVisitVariable('Chosen Language', getCurrentLanguage()); + if (window.location.hostname === 'riot.im') { + this._setVisitVariable('Instance', window.location.pathname); + } + (function() { const g = document.createElement('script'); const s = document.getElementsByTagName('script')[0]; From 0a2a782d63032ff3cdf2916c4aa084b2950e75ee Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 7 Jun 2017 11:26:52 +0100 Subject: [PATCH 3/3] track the action of opt-out Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/Analytics.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Analytics.js b/src/Analytics.js index b9f969973e..92691da1ea 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -56,6 +56,7 @@ class Analytics { * but this is second best, Piwik should not pull anything implicitly. */ disable() { + this.trackEvent('Analytics', 'opt-out'); this.disabled = true; }