From ecc6321e179ec2af2f4173a6b3bd37b12b60cd8d Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Thu, 18 Nov 2021 11:39:56 +0100 Subject: [PATCH] Add new action post hog Signed-off-by: Gregoire Parant --- front/src/Administration/AnalyticsClient.ts | 25 +++++++++++++++++++ front/src/Phaser/Login/CustomizeScene.ts | 3 +++ front/src/Phaser/Login/EnableCameraScene.ts | 3 +++ front/src/Phaser/Login/LoginScene.ts | 3 +++ .../src/Phaser/Login/SelectCharacterScene.ts | 4 +++ 5 files changed, 38 insertions(+) diff --git a/front/src/Administration/AnalyticsClient.ts b/front/src/Administration/AnalyticsClient.ts index 64548515..a63d9f08 100644 --- a/front/src/Administration/AnalyticsClient.ts +++ b/front/src/Administration/AnalyticsClient.ts @@ -47,6 +47,7 @@ class AnalyticsClient { this.posthogPromise .then((posthog) => { posthog.capture("$pageView", { roomId, roomGroup }); + posthog.capture("enteredRoom"); }) .catch(); } @@ -74,5 +75,29 @@ class AnalyticsClient { }) .catch(); } + + validationName() { + this.posthogPromise + .then((posthog) => { + posthog.capture("wa-name-validation"); + }) + .catch(); + } + + validationWoka(scene: string) { + this.posthogPromise + .then((posthog) => { + posthog.capture("wa-woka-validation", { scene }); + }) + .catch(); + } + + validationVideo() { + this.posthogPromise + .then((posthog) => { + posthog.capture("wa-video-validation"); + }) + .catch(); + } } export const analyticsClient = new AnalyticsClient(); diff --git a/front/src/Phaser/Login/CustomizeScene.ts b/front/src/Phaser/Login/CustomizeScene.ts index 04ccea2d..8cb82ba6 100644 --- a/front/src/Phaser/Login/CustomizeScene.ts +++ b/front/src/Phaser/Login/CustomizeScene.ts @@ -14,6 +14,7 @@ import { waScaleManager } from "../Services/WaScaleManager"; import { isMobile } from "../../Enum/EnvironmentVariable"; import { CustomizedCharacter } from "../Entity/CustomizedCharacter"; import { get } from "svelte/store"; +import { analyticsClient } from "../../Administration/AnalyticsClient"; export const CustomizeSceneName = "CustomizeScene"; @@ -278,6 +279,8 @@ export class CustomizeScene extends AbstractCharacterScene { return; } + analyticsClient.validationWoka("CustomizeWoka"); + gameManager.setCharacterLayers(layers); this.scene.sleep(CustomizeSceneName); waScaleManager.restoreZoom(); diff --git a/front/src/Phaser/Login/EnableCameraScene.ts b/front/src/Phaser/Login/EnableCameraScene.ts index 91a351ff..0f29f441 100644 --- a/front/src/Phaser/Login/EnableCameraScene.ts +++ b/front/src/Phaser/Login/EnableCameraScene.ts @@ -2,6 +2,7 @@ import { gameManager } from "../Game/GameManager"; import { ResizableScene } from "./ResizableScene"; import { enableCameraSceneVisibilityStore } from "../../Stores/MediaStore"; import { localUserStore } from "../../Connexion/LocalUserStore"; +import { analyticsClient } from "../../Administration/AnalyticsClient"; export const EnableCameraSceneName = "EnableCameraScene"; @@ -27,6 +28,8 @@ export class EnableCameraScene extends ResizableScene { update(time: number, delta: number): void {} public login(): void { + analyticsClient.validationVideo(); + enableCameraSceneVisibilityStore.hideEnableCameraScene(); this.scene.sleep(EnableCameraSceneName); diff --git a/front/src/Phaser/Login/LoginScene.ts b/front/src/Phaser/Login/LoginScene.ts index 6bba0290..94f04db9 100644 --- a/front/src/Phaser/Login/LoginScene.ts +++ b/front/src/Phaser/Login/LoginScene.ts @@ -4,6 +4,7 @@ import { loginSceneVisibleIframeStore, loginSceneVisibleStore } from "../../Stor import { localUserStore } from "../../Connexion/LocalUserStore"; import { connectionManager } from "../../Connexion/ConnectionManager"; import { gameManager } from "../Game/GameManager"; +import { analyticsClient } from "../../Administration/AnalyticsClient"; export const LoginSceneName = "LoginScene"; @@ -34,6 +35,8 @@ export class LoginScene extends ResizableScene { } public login(name: string): void { + analyticsClient.validationName(); + name = name.trim(); gameManager.setPlayerName(name); diff --git a/front/src/Phaser/Login/SelectCharacterScene.ts b/front/src/Phaser/Login/SelectCharacterScene.ts index dbb50c94..1f1eb3ce 100644 --- a/front/src/Phaser/Login/SelectCharacterScene.ts +++ b/front/src/Phaser/Login/SelectCharacterScene.ts @@ -13,6 +13,7 @@ import { PinchManager } from "../UserInput/PinchManager"; import { selectCharacterSceneVisibleStore } from "../../Stores/SelectCharacterStore"; import { waScaleManager } from "../Services/WaScaleManager"; import { isMobile } from "../../Enum/EnvironmentVariable"; +import { analyticsClient } from "../../Administration/AnalyticsClient"; //todo: put this constants in a dedicated file export const SelectCharacterSceneName = "SelectCharacterScene"; @@ -98,6 +99,9 @@ export class SelectCharacterScene extends AbstractCharacterScene { if (!this.selectedPlayer) { return; } + + analyticsClient.validationWoka("SelectWoka"); + this.scene.stop(SelectCharacterSceneName); waScaleManager.restoreZoom(); gameManager.setCharacterLayers([this.selectedPlayer.texture.key]);