diff --git a/src/ga/type.ts b/src/ga/type.ts index a3a2ade..18c0d1a 100644 --- a/src/ga/type.ts +++ b/src/ga/type.ts @@ -79,6 +79,7 @@ export enum GA_EventName { Inspector = "Inspector", EngineVersion = "engine_version", AppVersion = "app_version", + GameUrl = "game_url", GamePlayer = "game_player", GamePause = "game_pause", GameStep = "game_step", diff --git a/src/scripts/inject/event.ts b/src/scripts/inject/event.ts index 47c8580..f4be7fd 100644 --- a/src/scripts/inject/event.ts +++ b/src/scripts/inject/event.ts @@ -29,4 +29,9 @@ export class InjectEvent { const event = new CustomEvent(DocumentEvent.GoogleAnalytics, { detail }); document.dispatchEvent(event); } + sendUrl(url: string) { + const detail = { event: GA_EventName.GameUrl, params: url } as GoogleAnalyticsData; + const event = new CustomEvent(DocumentEvent.GoogleAnalytics, { detail }); + document.dispatchEvent(event); + } } diff --git a/src/scripts/inject/inspector.ts b/src/scripts/inject/inspector.ts index 8e0caf7..b16aa80 100644 --- a/src/scripts/inject/inspector.ts +++ b/src/scripts/inject/inspector.ts @@ -214,6 +214,7 @@ export class Inspector extends InjectEvent { if (version) { this.hasUploadEngineVersion = true; this.sendEngineVersion(version); + this.sendUrl(window.location.href); } } forEachNode(cb: (node: any) => void) {