Adjust abt variants

This commit is contained in:
tobspr 2022-06-12 15:55:43 +02:00
parent bdc34f1ddd
commit 48ac343260
12 changed files with 43 additions and 31 deletions

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

BIN
res/ui/steam_link_btn/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
res/ui/steam_link_btn/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
res/ui/steam_link_btn/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
res/ui/steam_link_btn/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
res/ui/steam_link_btn/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -80,10 +80,27 @@ $languages: en, de, cs, da, et, es-419, fr, it, pt-BR, sv, tr, el, ru, uk, zh-TW
}
}
/*
PRICE
*/
.steam_2_npr {
.steam_dlbtn_0 {
/* @load-async */
background-image: uiResource("get_on_steam.png") !important;
background-image: uiResource("steam_link_btn/0.png") !important;
}
.steam_dlbtn_1 {
/* @load-async */
background-image: uiResource("steam_link_btn/1.png") !important;
}
.steam_dlbtn_2 {
/* @load-async */
background-image: uiResource("steam_link_btn/2.png") !important;
}
.steam_dlbtn_3 {
/* @load-async */
background-image: uiResource("steam_link_btn/3.png") !important;
}
.steam_dlbtn_4 {
/* @load-async */
background-image: uiResource("steam_link_btn/4.png") !important;
}
.steam_dlbtn_5 {
/* @load-async */
background-image: uiResource("steam_link_btn/5.png") !important;
}

View File

@ -32,7 +32,7 @@
min-height: 40px;
& {
/* @load-async */
background: uiResource("get_on_steam.png") center center / contain no-repeat;
background: uiResource("steam_link_btn/0.png") center center / contain no-repeat;
}
overflow: hidden;
display: block;

View File

@ -30,9 +30,6 @@ export const THIRDPARTY_URLS = {
modBrowser: "https://shapez.mod.io/?preview=f55f6304ca4873d9a25f3b575571b948",
};
// export const A_B_TESTING_LINK_TYPE = Math.random() > 0.95 ? "steam_1_pr" : "steam_2_npr";
export const A_B_TESTING_LINK_TYPE = "steam_2_npr";
export const globalConfig = {
// Size of a single tile in Pixels.
// NOTICE: Update webpack.production.config too!

View File

@ -1,4 +1,4 @@
import { A_B_TESTING_LINK_TYPE, globalConfig, THIRDPARTY_URLS } from "../../../core/config";
import { globalConfig, THIRDPARTY_URLS } from "../../../core/config";
import { InputReceiver } from "../../../core/input_receiver";
import { makeDiv } from "../../../core/utils";
import { T } from "../../../translations";
@ -32,7 +32,7 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
<div class="lowerBar">
<div class="playtimeDisclaimer">${T.demoBanners.playtimeDisclaimer}</div>
<button class="steamLinkButton ${A_B_TESTING_LINK_TYPE}">
<button class="steamLinkButton steam_dlbtn_${this.root.app.gameAnalytics.abtVariant}">
${
globalConfig.currentDiscount > 0
? `<span class='discount'>${globalConfig.currentDiscount}% off!</span>`
@ -78,9 +78,12 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
this.inputReciever = new InputReceiver("standalone-advantages");
this.close();
this.lastShown = -1e10;
if (["1", "3"].includes(this.root.app.gameAnalytics.abtVariant)) {
// On standalone, show popup instant - but don't do so on web
if (G_IS_STEAM_DEMO) {
// show instant
this.lastShown = -1e10;
} else {
// wait for next interval
this.lastShown = 0;
}
}

View File

@ -18,8 +18,8 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha
// Be sure to increment the ID whenever it changes
const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin";
const CURRENT_ABT = "abt_ilig";
const CURRENT_ABT_COUNT = 4;
const CURRENT_ABT = "abt_dlbtn";
const CURRENT_ABT_COUNT = 6;
export class ShapezGameAnalytics extends GameAnalyticsInterface {
constructor(app) {
@ -54,8 +54,13 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
fetchABVariant() {
return this.app.storage.readFileAsync("shapez_" + CURRENT_ABT + ".bin").then(
abt => {
this.abtVariant = abt;
logger.log("Got abtVariant:", abt);
if (typeof queryParamOptions.abtVariant === "string") {
this.abtVariant = queryParamOptions.abtVariant;
logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant);
} else {
this.abtVariant = abt;
logger.log("Read abtVariant:", abt);
}
},
err => {
if (err === FILE_NOT_FOUND) {

View File

@ -1,6 +1,6 @@
import { getLogoSprite } from "../core/background_resources_loader";
import { cachebust } from "../core/cachebust";
import { A_B_TESTING_LINK_TYPE, globalConfig, THIRDPARTY_URLS } from "../core/config";
import { globalConfig, THIRDPARTY_URLS } from "../core/config";
import { GameState } from "../core/game_state";
import { DialogWithForm } from "../core/modal_dialog_elements";
import { FormElementInput } from "../core/modal_dialog_forms";
@ -76,7 +76,7 @@ export class MainMenuState extends GameState {
<h3>${T.demoBanners.title}</h3>
<p>${T.demoBanners.intro}</p>
<span class="playtimeDisclaimer">${T.demoBanners.playtimeDisclaimer}</span>
<a href="#" class="steamLink ${A_B_TESTING_LINK_TYPE}" target="_blank">
<a href="#" class="steamLink steam_dlbtn_${this.app.gameAnalytics.abtVariant}" target="_blank">
${
globalConfig.currentDiscount > 0
? `<span class='discount'>${globalConfig.currentDiscount}% off!</span>`
@ -378,16 +378,6 @@ export class MainMenuState extends GameState {
this.renderMainMenu();
this.renderSavegames();
if (
this.app.restrictionMgr.isLimitedVersion() &&
["0", "1"].includes(this.app.gameAnalytics.abtVariant) &&
this.app.savegameMgr.getSavegamesMetaData().length === 0 &&
!firstPlayForwarded
) {
firstPlayForwarded = true;
this.onPlayButtonClicked();
}
}
renderMainMenu() {
@ -459,7 +449,7 @@ export class MainMenuState extends GameState {
}
onSteamLinkClicked() {
this.app.analytics.trackUiClick("main_menu_steam_link_" + A_B_TESTING_LINK_TYPE);
this.app.analytics.trackUiClick("main_menu_steam_link");
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
this.app.platformWrapper.openExternalLink(
THIRDPARTY_URLS.stanaloneCampaignLink +