Remove debug mode on analytic events for release builds

This commit is contained in:
Lucas Dower 2023-06-26 16:38:21 +01:00
parent 8e7544075f
commit ae86e5d9d2
2 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import { AppConfig } from './config';
import { AppConsole } from './ui/console';
const gtag = require('ga-gtag');
@ -15,14 +16,16 @@ export class AppAnalytics {
public static Init() {
gtag.install('G-W0SCWQ7HGJ', { 'send_page_view': true });
gtag.gtag('config', 'G-W0SCWQ7HGJ', { 'debug_mode': true });
if (AppConfig.Get.VERSION_TYPE === 'd') {
gtag.gtag('config', 'G-W0SCWQ7HGJ', { 'debug_mode': true });
}
this.Get._ready = true;
}
public static Event(id: string, attributes?: any) {
if (this.Get._ready) {
console.log('[Analytics]: Tracked event', id, attributes);
gtag.gtag('event', id, Object.assign(attributes ?? {}, { 'debug_mode': true }));
gtag.gtag('event', id, Object.assign(attributes ?? {}, AppConfig.Get.VERSION_TYPE === 'd' ? { 'debug_mode': true } : {}));
}
}
}

View File

@ -8,11 +8,11 @@ export class AppConfig {
return this._instance || (this._instance = new this());
}
public readonly RELEASE_MODE = true;
public readonly RELEASE_MODE;
public readonly MAJOR_VERSION = 0;
public readonly MINOR_VERSION = 8;
public readonly HOTFIX_VERSION = 5;
public readonly VERSION_TYPE: 'd' | 'a' | 'r' = 'r'; // dev, alpha, or release build
public readonly HOTFIX_VERSION = 6;
public readonly VERSION_TYPE: 'd' | 'a' | 'r' = 'd'; // dev, alpha, or release build
public readonly MINECRAFT_VERSION = '1.19.4';
public readonly LOCALE = 'en_GB';
@ -43,6 +43,7 @@ export class AppConfig {
public readonly FRESNEL_MIX = 0.3;
private constructor() {
this.RELEASE_MODE = this.VERSION_TYPE === 'r';
}
public dumpConfig() {