mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-04 08:34:02 +00:00
Forward utm campaign
This commit is contained in:
parent
4e25bf4045
commit
1e6199b213
@ -4,6 +4,7 @@ const options = queryString.parse(location.search);
|
|||||||
export let queryParamOptions = {
|
export let queryParamOptions = {
|
||||||
embedProvider: null,
|
embedProvider: null,
|
||||||
abtVariant: null,
|
abtVariant: null,
|
||||||
|
campaign: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.embed) {
|
if (options.embed) {
|
||||||
@ -13,3 +14,6 @@ if (options.embed) {
|
|||||||
if (options.abtVariant) {
|
if (options.abtVariant) {
|
||||||
queryParamOptions.abtVariant = options.abtVariant;
|
queryParamOptions.abtVariant = options.abtVariant;
|
||||||
}
|
}
|
||||||
|
if (options.utm_campaign) {
|
||||||
|
queryParamOptions.campaign = options.utm_campaign;
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { cachebust } from "../core/cachebust";
|
|||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { GameState } from "../core/game_state";
|
import { GameState } from "../core/game_state";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
|
import { queryParamOptions } from "../core/query_parameters";
|
||||||
import { authorizeViaSSOToken } from "../core/steam_sso";
|
import { authorizeViaSSOToken } from "../core/steam_sso";
|
||||||
import { getLogoSprite, timeoutPromise } from "../core/utils";
|
import { getLogoSprite, timeoutPromise } from "../core/utils";
|
||||||
import { getRandomHint } from "../game/hints";
|
import { getRandomHint } from "../game/hints";
|
||||||
@ -64,6 +65,20 @@ export class PreloadState extends GameState {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sendBeacon() {
|
||||||
|
if (G_IS_STANDALONE && !G_IS_STEAM_DEMO) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!queryParamOptions.campaign) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fetch(
|
||||||
|
"https://analytics.shapez.io/campaign/" + queryParamOptions.campaign + "?lpurl=nocontent"
|
||||||
|
).catch(err => {
|
||||||
|
console.warn("Failed to send beacon:", err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onLeave() {
|
onLeave() {
|
||||||
// this.dialogs.cleanup();
|
// this.dialogs.cleanup();
|
||||||
}
|
}
|
||||||
@ -72,6 +87,7 @@ export class PreloadState extends GameState {
|
|||||||
this.setStatus("Booting")
|
this.setStatus("Booting")
|
||||||
|
|
||||||
.then(() => this.setStatus("Creating platform wrapper", 3))
|
.then(() => this.setStatus("Creating platform wrapper", 3))
|
||||||
|
.then(() => this.sendBeacon())
|
||||||
.then(() => authorizeViaSSOToken(this.app, this.dialogs))
|
.then(() => authorizeViaSSOToken(this.app, this.dialogs))
|
||||||
|
|
||||||
.then(() => this.app.platformWrapper.initialize())
|
.then(() => this.app.platformWrapper.initialize())
|
||||||
|
Loading…
Reference in New Issue
Block a user