mirror of https://github.com/vector-im/riot-web
Merge pull request #1046 from matrix-org/t3chguy/piwik_fixes_1
Various Analytics changes/fixes/improvementspull/21833/head
commit
bfa095184d
|
@ -20,9 +20,9 @@ import PlatformPeg from './PlatformPeg';
|
||||||
import SdkConfig from './SdkConfig';
|
import SdkConfig from './SdkConfig';
|
||||||
|
|
||||||
function getRedactedUrl() {
|
function getRedactedUrl() {
|
||||||
const base = window.location.pathname.split('/').slice(-2).join('/');
|
|
||||||
const redactedHash = window.location.hash.replace(/#\/(room|user)\/(.+)/, "#/$1/<redacted>");
|
const redactedHash = window.location.hash.replace(/#\/(room|user)\/(.+)/, "#/$1/<redacted>");
|
||||||
return base + redactedHash;
|
// hardcoded url to make piwik happy
|
||||||
|
return 'https://riot.im/app/' + redactedHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
const customVariables = {
|
const customVariables = {
|
||||||
|
@ -30,6 +30,7 @@ const customVariables = {
|
||||||
'App Version': 2,
|
'App Version': 2,
|
||||||
'User Type': 3,
|
'User Type': 3,
|
||||||
'Chosen Language': 4,
|
'Chosen Language': 4,
|
||||||
|
'Instance': 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ class Analytics {
|
||||||
* but this is second best, Piwik should not pull anything implicitly.
|
* but this is second best, Piwik should not pull anything implicitly.
|
||||||
*/
|
*/
|
||||||
disable() {
|
disable() {
|
||||||
|
this.trackEvent('Analytics', 'opt-out');
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +88,10 @@ class Analytics {
|
||||||
|
|
||||||
this._setVisitVariable('Chosen Language', getCurrentLanguage());
|
this._setVisitVariable('Chosen Language', getCurrentLanguage());
|
||||||
|
|
||||||
|
if (window.location.hostname === 'riot.im') {
|
||||||
|
this._setVisitVariable('Instance', window.location.pathname);
|
||||||
|
}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
const g = document.createElement('script');
|
const g = document.createElement('script');
|
||||||
const s = document.getElementsByTagName('script')[0];
|
const s = document.getElementsByTagName('script')[0];
|
||||||
|
|
Loading…
Reference in New Issue