Skip to content

Commit 60a56d0

Browse files
authored
Merge pull request element-hq#4056 from vector-im/t3chguy/piwik
Piwik Analytics
2 parents e405d3f + b9ec25b commit 60a56d0

8 files changed

Lines changed: 34 additions & 13 deletions

File tree

‎config.sample.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@
1010
"servers": [
1111
"matrix.org"
1212
]
13+
},
14+
"piwik": {
15+
"url": "https://piwik.riot.im/",
16+
"siteId": 1
1317
}
1418
}

‎electron_app/riot.im/config.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
"servers": [
1313
"matrix.org"
1414
]
15+
},
16+
"piwik": {
17+
"url": "https://piwik.riot.im/",
18+
"siteId": 1
1519
}
1620
}

‎src/components/structures/RightPanel.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import sdk from 'matrix-react-sdk';
2222
import Matrix from "matrix-js-sdk";
2323
import dis from 'matrix-react-sdk/lib/dispatcher';
2424
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
25+
import Analytics from 'matrix-react-sdk/lib/Analytics';
2526
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
2627
import Modal from 'matrix-react-sdk/lib/Modal';
2728
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
@@ -61,24 +62,26 @@ module.exports = React.createClass({
6162
return {
6263
phase: this.Phase.MemberInfo,
6364
member: member,
64-
}
65-
}
66-
else {
65+
};
66+
} else {
6767
return {
6868
phase: this.Phase.MemberList
69-
}
69+
};
7070
}
7171
},
7272

7373
onMemberListButtonClick: function() {
74+
Analytics.trackEvent('Right Panel', 'Member List Button', 'click');
7475
this.setState({ phase: this.Phase.MemberList });
7576
},
7677

7778
onFileListButtonClick: function() {
79+
Analytics.trackEvent('Right Panel', 'File List Button', 'click');
7880
this.setState({ phase: this.Phase.FilePanel });
7981
},
8082

8183
onNotificationListButtonClick: function() {
84+
Analytics.trackEvent('Right Panel', 'Notification List Button', 'click');
8285
this.setState({ phase: this.Phase.NotificationPanel });
8386
},
8487

‎src/components/views/globals/MatrixToolbar.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ limitations under the License.
1616

1717
'use strict';
1818

19-
var React = require('react');
19+
import React from 'react';
2020
import { _t } from 'matrix-react-sdk/lib/languageHandler';
21-
var Notifier = require("matrix-react-sdk/lib/Notifier");
22-
var sdk = require('matrix-react-sdk')
23-
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
21+
import Notifier from 'matrix-react-sdk/lib/Notifier';
22+
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
2423

2524
module.exports = React.createClass({
2625
displayName: 'MatrixToolbar',
@@ -43,5 +42,5 @@ module.exports = React.createClass({
4342
<AccessibleButton className="mx_MatrixToolbar_close" onClick={ this.hideToolbar } ><img src="img/cancel.svg" width="18" height="18" /></AccessibleButton>
4443
</div>
4544
);
46-
}
45+
},
4746
});

‎src/vector/index.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if (process.env.NODE_ENV !== 'production') {
5656
var RunModernizrTests = require("./modernizr"); // this side-effects a global
5757
var ReactDOM = require("react-dom");
5858
var sdk = require("matrix-react-sdk");
59-
var PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
59+
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
6060
sdk.loadSkin(require('../component-index'));
6161
var VectorConferenceHandler = require('../VectorConferenceHandler');
6262
var UpdateChecker = require("./updater");
@@ -143,7 +143,7 @@ var onNewScreen = function(screen) {
143143
var hash = '#/' + screen;
144144
lastLocationHashSet = hash;
145145
window.location.hash = hash;
146-
}
146+
};
147147

148148
// We use this to work out what URL the SDK should
149149
// pass through when registering to allow the user to
@@ -295,8 +295,7 @@ async function loadApp() {
295295
/>,
296296
document.getElementById('matrixchat')
297297
);
298-
}
299-
else {
298+
} else {
300299
console.error("Browser is missing required features.");
301300
// take to a different landing page to AWOOOOOGA at the user
302301
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
6767
dis.register(_onAction);
6868
}
6969

70+
getHumanReadableName(): string {
71+
return 'Electron Platform';
72+
}
73+
7074
setNotificationCount(count: number) {
7175
if (this.notificationCount === count) return;
7276
super.setNotificationCount(count);

‎src/vector/platform/VectorBasePlatform.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export default class VectorBasePlatform extends BasePlatform {
3535
this._updateFavicon();
3636
}
3737

38+
getHumanReadableName(): string {
39+
return 'Vector Base Platform';
40+
}
41+
3842
_updateFavicon() {
3943
try {
4044
// This needs to be in in a try block as it will throw

‎src/vector/platform/WebPlatform.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export default class WebPlatform extends VectorBasePlatform {
3131
this.runningVersion = null;
3232
}
3333

34+
getHumanReadableName(): string {
35+
return 'Web Platform';
36+
}
37+
3438
/**
3539
* Returns true if the platform supports displaying
3640
* notifications, otherwise false.

0 commit comments

Comments
 (0)