mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-07 10:03:59 +00:00
Add missing tracking
This commit is contained in:
parent
52629c5bb2
commit
b446a4a915
@ -101,7 +101,9 @@
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
@include S(border-radius, $globalBorderRadius);
|
@include S(border-radius, $globalBorderRadius);
|
||||||
// box-shadow: 0 D(5px) D(15px) rgba(#000, 0.2);
|
// box-shadow: 0 D(5px) D(15px) rgba(#000, 0.2);
|
||||||
@include S(width, 380px);
|
@include S(min-width, 340px);
|
||||||
|
@include S(max-width, 380px);
|
||||||
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@include S(padding, 0, 15px);
|
@include S(padding, 0, 15px);
|
||||||
// backdrop-filter: blur(10px);
|
// backdrop-filter: blur(10px);
|
||||||
@ -209,13 +211,13 @@
|
|||||||
.point {
|
.point {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: #{D(27px)} auto;
|
grid-template-columns: #{D(27px)} auto;
|
||||||
grid-template-rows: D(11px) D(10px);
|
grid-template-rows: 1fr 1fr;
|
||||||
background: #fff #{D(10px)} center / #{D(17px)} no-repeat;
|
background: #fff #{D(10px)} center / #{D(17px)} no-repeat;
|
||||||
@include S(grid-row-gap, 3px);
|
@include S(grid-row-gap, 2px);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@include S(padding, 6px);
|
@include S(padding, 6px);
|
||||||
@include S(border-radius, $globalBorderRadius);
|
@include S(border-radius, $globalBorderRadius);
|
||||||
|
@include S(height, 26px);
|
||||||
box-shadow: 0 D(5px) D(10px) rgba(#000, 0.2);
|
box-shadow: 0 D(5px) D(10px) rgba(#000, 0.2);
|
||||||
|
|
||||||
> strong {
|
> strong {
|
||||||
@ -234,11 +236,9 @@
|
|||||||
grid-column: 2 / 3;
|
grid-column: 2 / 3;
|
||||||
grid-row: 2 / 3;
|
grid-row: 2 / 3;
|
||||||
@include SuperSmallText;
|
@include SuperSmallText;
|
||||||
white-space: nowrap;
|
|
||||||
@include BreakText;
|
|
||||||
@include S(font-size, 8px);
|
@include S(font-size, 8px);
|
||||||
line-height: 1em;
|
line-height: 1em;
|
||||||
align-self: start;
|
align-self: center;
|
||||||
|
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ export const THIRDPARTY_URLS = {
|
|||||||
export function openStandaloneLink(app, campaign) {
|
export function openStandaloneLink(app, campaign) {
|
||||||
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
||||||
const steamSuffix = G_IS_STEAM_DEMO ? "_steamdemo" : "";
|
const steamSuffix = G_IS_STEAM_DEMO ? "_steamdemo" : "";
|
||||||
app.platformWrapper.openExternalLink(
|
const event = campaign + discount + steamSuffix;
|
||||||
THIRDPARTY_URLS.standaloneCampaignLink.replace("$campaign", campaign + discount + steamSuffix)
|
app.platformWrapper.openExternalLink(THIRDPARTY_URLS.standaloneCampaignLink.replace("$campaign", event));
|
||||||
);
|
app.gameAnalytics.noteMinor("g.stdlink." + event);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const globalConfig = {
|
export const globalConfig = {
|
||||||
|
@ -117,6 +117,10 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show(final = false) {
|
show(final = false) {
|
||||||
|
if (!this.visible) {
|
||||||
|
this.root.app.gameAnalytics.noteMinor("game.std_advg.show");
|
||||||
|
this.root.app.gameAnalytics.noteMinor("game.std_advg.show-" + (final ? "final" : "nonfinal"));
|
||||||
|
}
|
||||||
this.lastShown = this.root.time.now();
|
this.lastShown = this.root.time.now();
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.final = final;
|
this.final = final;
|
||||||
|
@ -24,6 +24,8 @@ export class HUDUnlockNotification extends BaseHUDPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.buttonShowTimeout = null;
|
this.buttonShowTimeout = null;
|
||||||
|
|
||||||
|
this.root.app.gameAnalytics.noteMinor("game.started");
|
||||||
}
|
}
|
||||||
|
|
||||||
createElements(parent) {
|
createElements(parent) {
|
||||||
@ -63,6 +65,8 @@ export class HUDUnlockNotification extends BaseHUDPart {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.root.app.gameAnalytics.noteMinor("game.level.complete-" + level);
|
||||||
|
|
||||||
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
|
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
|
||||||
this.elemTitle.innerText = T.ingame.levelCompleteNotification.levelTitle.replace(
|
this.elemTitle.innerText = T.ingame.levelCompleteNotification.levelTitle.replace(
|
||||||
"<level>",
|
"<level>",
|
||||||
|
@ -14,11 +14,18 @@ import { FILE_NOT_FOUND } from "../storage";
|
|||||||
import OR from "@openreplay/tracker";
|
import OR from "@openreplay/tracker";
|
||||||
import OR_fetch from "@openreplay/tracker-fetch";
|
import OR_fetch from "@openreplay/tracker-fetch";
|
||||||
|
|
||||||
let connector;
|
let eventConnector;
|
||||||
if ((G_IS_STEAM_DEMO || !G_IS_STANDALONE) && !G_IS_DEV) {
|
if (!G_IS_STANDALONE && !G_IS_DEV) {
|
||||||
connector = new OR({ projectKey: "mhZgUFQBI6QAtt3PRLer" });
|
eventConnector = new OR({
|
||||||
connector.start();
|
projectKey: "mhZgUFQBI6QAtt3PRLer",
|
||||||
connector.use(OR_fetch({ overrideGlobal: true }));
|
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 logger = createLogger("game_analytics");
|
||||||
@ -111,6 +118,16 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noteMinor(action, payload = "") {
|
||||||
|
if (eventConnector) {
|
||||||
|
try {
|
||||||
|
eventConnector.event(action, payload);
|
||||||
|
} catch (ex) {
|
||||||
|
console.warn("Failed to note event:", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
@ -153,8 +170,8 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
syncKey => {
|
syncKey => {
|
||||||
this.syncKey = syncKey;
|
this.syncKey = syncKey;
|
||||||
logger.log("Player sync key read:", this.syncKey);
|
logger.log("Player sync key read:", this.syncKey);
|
||||||
if (connector) {
|
if (eventConnector) {
|
||||||
connector.setUserID(connector);
|
eventConnector.setUserID(syncKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
@ -195,8 +212,8 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
this.syncKey = res.key;
|
this.syncKey = res.key;
|
||||||
logger.log("Key retrieved:", this.syncKey);
|
logger.log("Key retrieved:", this.syncKey);
|
||||||
this.app.storage.writeFileAsync(analyticsLocalFile, res.key);
|
this.app.storage.writeFileAsync(analyticsLocalFile, res.key);
|
||||||
if (connector) {
|
if (eventConnector) {
|
||||||
connector.setUserID(connector);
|
eventConnector.setUserID(eventConnector);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Bad response from analytics server: " + res);
|
throw new Error("Bad response from analytics server: " + res);
|
||||||
|
@ -404,6 +404,8 @@ export class MainMenuState extends GameState {
|
|||||||
this.fetchPlayerCount();
|
this.fetchPlayerCount();
|
||||||
|
|
||||||
this.refreshInterval = setInterval(() => this.fetchPlayerCount(), 10000);
|
this.refreshInterval = setInterval(() => this.fetchPlayerCount(), 10000);
|
||||||
|
|
||||||
|
this.app.gameAnalytics.noteMinor("menu.enter");
|
||||||
}
|
}
|
||||||
|
|
||||||
renderMainMenu() {
|
renderMainMenu() {
|
||||||
@ -798,11 +800,13 @@ export class MainMenuState extends GameState {
|
|||||||
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
||||||
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
||||||
) {
|
) {
|
||||||
|
this.app.gameAnalytics.noteMinor("menu.slotlimit");
|
||||||
this.showSavegameSlotLimit();
|
this.showSavegameSlotLimit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.adProvider.showVideoAd().then(() => {
|
this.app.adProvider.showVideoAd().then(() => {
|
||||||
|
this.app.gameAnalytics.noteMinor("menu.play");
|
||||||
const savegame = this.app.savegameMgr.createNewSavegame();
|
const savegame = this.app.savegameMgr.createNewSavegame();
|
||||||
|
|
||||||
this.moveToState("InGameState", {
|
this.moveToState("InGameState", {
|
||||||
@ -824,6 +828,7 @@ export class MainMenuState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onModsClicked() {
|
onModsClicked() {
|
||||||
|
this.app.gameAnalytics.noteMinor("menu.mods");
|
||||||
this.moveToState("ModsState", {
|
this.moveToState("ModsState", {
|
||||||
backToStateId: "MainMenuState",
|
backToStateId: "MainMenuState",
|
||||||
});
|
});
|
||||||
@ -845,6 +850,7 @@ export class MainMenuState extends GameState {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.app.gameAnalytics.noteMinor("menu.continue");
|
||||||
savegame
|
savegame
|
||||||
.readAsync()
|
.readAsync()
|
||||||
.then(() => this.app.adProvider.showVideoAd())
|
.then(() => this.app.adProvider.showVideoAd())
|
||||||
|
Loading…
Reference in New Issue
Block a user