|
|
|
@ -10,25 +10,8 @@ import { InGameState } from "../../states/ingame";
|
|
|
|
|
import { SteamAchievementProvider } from "../electron/steam_achievement_provider";
|
|
|
|
|
import { GameAnalyticsInterface } from "../game_analytics";
|
|
|
|
|
import { FILE_NOT_FOUND } from "../storage";
|
|
|
|
|
|
|
|
|
|
import OR from "@openreplay/tracker";
|
|
|
|
|
import OR_fetch from "@openreplay/tracker-fetch";
|
|
|
|
|
import { WEB_STEAM_SSO_AUTHENTICATED } from "../../core/steam_sso";
|
|
|
|
|
|
|
|
|
|
let eventConnector;
|
|
|
|
|
if (!G_IS_STANDALONE && !G_IS_DEV) {
|
|
|
|
|
eventConnector = new OR({
|
|
|
|
|
projectKey: "mhZgUFQBI6QAtt3PRLer",
|
|
|
|
|
respectDoNotTrack: true,
|
|
|
|
|
revID: G_BUILD_COMMIT_HASH,
|
|
|
|
|
heatmaps: false,
|
|
|
|
|
verbose: false,
|
|
|
|
|
captureIFrames: false,
|
|
|
|
|
});
|
|
|
|
|
eventConnector.start({});
|
|
|
|
|
eventConnector.use(OR_fetch({ overrideGlobal: true }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const logger = createLogger("game_analytics");
|
|
|
|
|
|
|
|
|
|
const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.shapez.io";
|
|
|
|
@ -123,15 +106,7 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
noteMinor(action, payload = "") {
|
|
|
|
|
if (eventConnector) {
|
|
|
|
|
try {
|
|
|
|
|
eventConnector.event(action, payload);
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
console.warn("Failed to note event:", ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
noteMinor(action, payload = "") {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
@ -175,9 +150,6 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|
|
|
|
syncKey => {
|
|
|
|
|
this.syncKey = syncKey;
|
|
|
|
|
logger.log("Player sync key read:", this.syncKey);
|
|
|
|
|
if (eventConnector) {
|
|
|
|
|
eventConnector.setUserID(syncKey);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error => {
|
|
|
|
|
// File was not found, retrieve new key
|
|
|
|
@ -217,9 +189,6 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|
|
|
|
this.syncKey = res.key;
|
|
|
|
|
logger.log("Key retrieved:", this.syncKey);
|
|
|
|
|
this.app.storage.writeFileAsync(analyticsLocalFile, res.key);
|
|
|
|
|
if (eventConnector) {
|
|
|
|
|
eventConnector.setUserID(eventConnector);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error("Bad response from analytics server: " + res);
|
|
|
|
|
}
|
|
|
|
|