initial piwik stuff
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
09adfbd6d6
commit
61a67c52c5
|
@ -22,6 +22,7 @@ import sdk from 'matrix-react-sdk';
|
||||||
import Matrix from "matrix-js-sdk";
|
import Matrix from "matrix-js-sdk";
|
||||||
import dis from 'matrix-react-sdk/lib/dispatcher';
|
import dis from 'matrix-react-sdk/lib/dispatcher';
|
||||||
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
||||||
|
import Analytics from 'matrix-react-sdk/lib/Analytics';
|
||||||
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
|
import rate_limited_func from 'matrix-react-sdk/lib/ratelimitedfunc';
|
||||||
import Modal from 'matrix-react-sdk/lib/Modal';
|
import Modal from 'matrix-react-sdk/lib/Modal';
|
||||||
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
|
||||||
|
@ -61,24 +62,26 @@ module.exports = React.createClass({
|
||||||
return {
|
return {
|
||||||
phase: this.Phase.MemberInfo,
|
phase: this.Phase.MemberInfo,
|
||||||
member: member,
|
member: member,
|
||||||
}
|
};
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return {
|
return {
|
||||||
phase: this.Phase.MemberList
|
phase: this.Phase.MemberList
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onMemberListButtonClick: function() {
|
onMemberListButtonClick: function() {
|
||||||
|
Analytics.trackEvent('RightPanel', 'memberListButtonClick');
|
||||||
this.setState({ phase: this.Phase.MemberList });
|
this.setState({ phase: this.Phase.MemberList });
|
||||||
},
|
},
|
||||||
|
|
||||||
onFileListButtonClick: function() {
|
onFileListButtonClick: function() {
|
||||||
|
Analytics.trackEvent('RightPanel', 'fileListButtonClick');
|
||||||
this.setState({ phase: this.Phase.FilePanel });
|
this.setState({ phase: this.Phase.FilePanel });
|
||||||
},
|
},
|
||||||
|
|
||||||
onNotificationListButtonClick: function() {
|
onNotificationListButtonClick: function() {
|
||||||
|
Analytics.trackEvent('RightPanel', 'notificationListButtonClick');
|
||||||
this.setState({ phase: this.Phase.NotificationPanel });
|
this.setState({ phase: this.Phase.NotificationPanel });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ if (process.env.NODE_ENV !== 'production') {
|
||||||
var RunModernizrTests = require("./modernizr"); // this side-effects a global
|
var RunModernizrTests = require("./modernizr"); // this side-effects a global
|
||||||
var ReactDOM = require("react-dom");
|
var ReactDOM = require("react-dom");
|
||||||
var sdk = require("matrix-react-sdk");
|
var sdk = require("matrix-react-sdk");
|
||||||
var PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
|
const PlatformPeg = require("matrix-react-sdk/lib/PlatformPeg");
|
||||||
|
const Analytics = require("matrix-react-sdk/lib/Analytics");
|
||||||
sdk.loadSkin(require('../component-index'));
|
sdk.loadSkin(require('../component-index'));
|
||||||
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
var VectorConferenceHandler = require('../VectorConferenceHandler');
|
||||||
var UpdateChecker = require("./updater");
|
var UpdateChecker = require("./updater");
|
||||||
|
@ -143,7 +144,7 @@ var onNewScreen = function(screen) {
|
||||||
var hash = '#/' + screen;
|
var hash = '#/' + screen;
|
||||||
lastLocationHashSet = hash;
|
lastLocationHashSet = hash;
|
||||||
window.location.hash = hash;
|
window.location.hash = hash;
|
||||||
}
|
};
|
||||||
|
|
||||||
// We use this to work out what URL the SDK should
|
// We use this to work out what URL the SDK should
|
||||||
// pass through when registering to allow the user to
|
// pass through when registering to allow the user to
|
||||||
|
@ -279,6 +280,26 @@ async function loadApp() {
|
||||||
} else if (validBrowser) {
|
} else if (validBrowser) {
|
||||||
UpdateChecker.start();
|
UpdateChecker.start();
|
||||||
|
|
||||||
|
let doNotTrack = navigator.doNotTrack;
|
||||||
|
if (typeof navigator.doNotTrack === 'string') {
|
||||||
|
doNotTrack = navigator.doNotTrack === 'yes';
|
||||||
|
}
|
||||||
|
if (!doNotTrack && configJson.piwik && configJson.piwik.url && configJson.piwik.siteId) {
|
||||||
|
(function() {
|
||||||
|
const g = document.createElement('script');
|
||||||
|
const s = document.getElementsByTagName('script')[0];
|
||||||
|
g.type='text/javascript'; g.async=true; g.defer=true; g.src=configJson.piwik.url+'piwik.js';
|
||||||
|
|
||||||
|
g.onload = function() {
|
||||||
|
const tracker = window.Piwik.getTracker(configJson.piwik.url+'piwik.php', configJson.piwik.siteId);
|
||||||
|
console.log('Initialised anonymous analytics');
|
||||||
|
Analytics.set(tracker);
|
||||||
|
};
|
||||||
|
|
||||||
|
s.parentNode.insertBefore(g, s);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||||
window.matrixChat = ReactDOM.render(
|
window.matrixChat = ReactDOM.render(
|
||||||
<MatrixChat
|
<MatrixChat
|
||||||
|
@ -295,8 +316,7 @@ async function loadApp() {
|
||||||
/>,
|
/>,
|
||||||
document.getElementById('matrixchat')
|
document.getElementById('matrixchat')
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
console.error("Browser is missing required features.");
|
console.error("Browser is missing required features.");
|
||||||
// take to a different landing page to AWOOOOOGA at the user
|
// take to a different landing page to AWOOOOOGA at the user
|
||||||
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
|
var CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
|
||||||
|
|
Loading…
Reference in New Issue