move all piwik init stuff to MatrixChat/Analytics
as it now relies on SDKConfig Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
3e7ef112f0
commit
3e7b738b11
|
@ -57,7 +57,6 @@ 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");
|
||||||
const 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");
|
||||||
|
@ -280,23 +279,6 @@ async function loadApp() {
|
||||||
} else if (validBrowser) {
|
} else if (validBrowser) {
|
||||||
UpdateChecker.start();
|
UpdateChecker.start();
|
||||||
|
|
||||||
const analyticsEnabled = !UserSettingsStore.getLocalSetting('analyticsOptOut', false);
|
|
||||||
if (analyticsEnabled && 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
|
||||||
|
|
Loading…
Reference in New Issue