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 = {
|
||||
embedProvider: null,
|
||||
abtVariant: null,
|
||||
campaign: null,
|
||||
};
|
||||
|
||||
if (options.embed) {
|
||||
|
@ -13,3 +14,6 @@ if (options.embed) {
|
|||
if (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 { GameState } from "../core/game_state";
|
||||
import { createLogger } from "../core/logging";
|
||||
import { queryParamOptions } from "../core/query_parameters";
|
||||
import { authorizeViaSSOToken } from "../core/steam_sso";
|
||||
import { getLogoSprite, timeoutPromise } from "../core/utils";
|
||||
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() {
|
||||
// this.dialogs.cleanup();
|
||||
}
|
||||
|
@ -72,6 +87,7 @@ export class PreloadState extends GameState {
|
|||
this.setStatus("Booting")
|
||||
|
||||
.then(() => this.setStatus("Creating platform wrapper", 3))
|
||||
.then(() => this.sendBeacon())
|
||||
.then(() => authorizeViaSSOToken(this.app, this.dialogs))
|
||||
|
||||
.then(() => this.app.platformWrapper.initialize())
|
||||
|
|
Loading…
Reference in New Issue