mirror of https://github.com/vector-im/riot-web
Modify showDetailsModal to give examples if analytics is not enabled
parent
e0a3debb7a
commit
6f77b8ae26
|
@ -49,34 +49,42 @@ const customVariables = {
|
|||
'App Platform': {
|
||||
id: 1,
|
||||
expl: _td('The platform you\'re on'),
|
||||
example: 'Electron Platform',
|
||||
},
|
||||
'App Version': {
|
||||
id: 2,
|
||||
expl: _td('The version of Riot.im'),
|
||||
example: '15.0.0',
|
||||
},
|
||||
'User Type': {
|
||||
id: 3,
|
||||
expl: _td('Whether or not you\'re logged in (we don\'t record your user name)'),
|
||||
example: 'Logged In',
|
||||
},
|
||||
'Chosen Language': {
|
||||
id: 4,
|
||||
expl: _td('Your language of choice'),
|
||||
example: 'en',
|
||||
},
|
||||
'Instance': {
|
||||
id: 5,
|
||||
expl: _td('Which officially provided instance you are using, if any'),
|
||||
example: 'app',
|
||||
},
|
||||
'RTE: Uses Richtext Mode': {
|
||||
id: 6,
|
||||
expl: _td('Whether or not you\'re using the Richtext mode of the Rich Text Editor'),
|
||||
example: 'off',
|
||||
},
|
||||
'Homeserver URL': {
|
||||
id: 7,
|
||||
expl: _td('Your homeserver\'s URL'),
|
||||
example: 'https://matrix.org',
|
||||
},
|
||||
'Identity Server URL': {
|
||||
id: 8,
|
||||
expl: _td('Your identity server\'s URL'),
|
||||
example: 'https://vector.im',
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -218,8 +226,19 @@ class Analytics {
|
|||
}
|
||||
|
||||
showDetailsModal() {
|
||||
const Tracker = window.Piwik.getAsyncTracker();
|
||||
const rows = Object.values(customVariables).map((v) => Tracker.getCustomVariable(v.id)).filter(Boolean);
|
||||
let rows = [];
|
||||
if (window.Piwik) {
|
||||
const Tracker = window.Piwik.getAsyncTracker();
|
||||
rows = Object.values(customVariables).map((v) => Tracker.getCustomVariable(v.id)).filter(Boolean);
|
||||
} else {
|
||||
// Piwik may not have been enabled, so show example values
|
||||
rows = Object.keys(customVariables).map(
|
||||
(k) => [
|
||||
k,
|
||||
_t('e.g. %(exampleValue)s', { exampleValue: customVariables[k].example }),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
const resolution = `${window.screen.width}x${window.screen.height}`;
|
||||
const otherVariables = [
|
||||
|
@ -247,7 +266,7 @@ class Analytics {
|
|||
<table>
|
||||
{ rows.map((row) => <tr key={row[0]}>
|
||||
<td>{ _t(customVariables[row[0]].expl) }</td>
|
||||
<td><code>{ row[1] }</code></td>
|
||||
{ row[1] !== undefined && <td><code>{ row[1] }</code></td> }
|
||||
</tr>) }
|
||||
{ otherVariables.map((item, index) =>
|
||||
<tr key={index}>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"Whether or not you're using the Richtext mode of the Rich Text Editor": "Whether or not you're using the Richtext mode of the Rich Text Editor",
|
||||
"Your homeserver's URL": "Your homeserver's URL",
|
||||
"Your identity server's URL": "Your identity server's URL",
|
||||
"e.g. %(exampleValue)s": "e.g. %(exampleValue)s",
|
||||
"Every page you use in the app": "Every page you use in the app",
|
||||
"e.g. <CurrentPageURL>": "e.g. <CurrentPageURL>",
|
||||
"Your User Agent": "Your User Agent",
|
||||
|
|
Loading…
Reference in New Issue