Disable analytics and logrocket for now

This commit is contained in:
tobspr 2020-06-10 11:52:59 +02:00
parent 95a437a8bb
commit fad7a417f2
2 changed files with 31 additions and 28 deletions

View File

@ -36,6 +36,7 @@ import { MainMenuState } from "./states/main_menu";
import { MobileWarningState } from "./states/mobile_warning";
import { PreloadState } from "./states/preload";
import { SettingsState } from "./states/settings";
import { NoGameAnalytics } from "./platform/browser/no_game_analytics";
const logger = createLogger("application");
@ -133,7 +134,8 @@ export class Application {
this.adProvider = new NoAdProvider(this);
this.sound = new SoundImplBrowser(this);
this.analytics = new GoogleAnalyticsImpl(this);
this.gameAnalytics = new ShapezGameAnalytics(this);
// this.gameAnalytics = new ShapezGameAnalytics(this);
this.gameAnalytics = new NoGameAnalytics(this);
}
/**

View File

@ -18,35 +18,36 @@ if (window.coreThreadLoadedCb) {
window.coreThreadLoadedCb();
}
if (!G_IS_DEV && !G_IS_STANDALONE) {
const monthlyUsers = 300; // thousand
const logrocketLimit = 10; // thousand
const percentageOfUsers = logrocketLimit / monthlyUsers;
// Logrocket
// if (!G_IS_DEV && !G_IS_STANDALONE) {
// const monthlyUsers = 300; // thousand
// const logrocketLimit = 10; // thousand
// const percentageOfUsers = logrocketLimit / monthlyUsers;
if (Math.random() <= percentageOfUsers) {
logger.log("Analyzing this session with logrocket");
const logrocket = require("logrocket");
logrocket.init("p1x9zh/shapezio");
// if (Math.random() <= percentageOfUsers) {
// logger.log("Analyzing this session with logrocket");
// const logrocket = require("logrocket");
// logrocket.init("p1x9zh/shapezio");
try {
logrocket.getSessionURL(function (sessionURL) {
logger.log("Connected lockrocket to GA");
// @ts-ignore
try {
window.ga("send", {
hitType: "event",
eventCategory: "LogRocket",
eventAction: sessionURL,
});
} catch (ex) {
logger.warn("Logrocket connection to analytics failed:", ex);
}
});
} catch (ex) {
logger.warn("Logrocket connection to analytics failed:", ex);
}
}
}
// try {
// logrocket.getSessionURL(function (sessionURL) {
// logger.log("Connected lockrocket to GA");
// // @ts-ignore
// try {
// window.ga("send", {
// hitType: "event",
// eventCategory: "LogRocket",
// eventAction: sessionURL,
// });
// } catch (ex) {
// logger.warn("Logrocket connection to analytics failed:", ex);
// }
// });
// } catch (ex) {
// logger.warn("Logrocket connection to analytics failed:", ex);
// }
// }
// }
console.log(
`%cshapez.io %c\n© 2020 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(