From 4a5f61c8519d1439a6168561ac39d144ba7a414a Mon Sep 17 00:00:00 2001 From: Bill Mei Date: Sat, 4 Jun 2022 15:39:43 -0400 Subject: [PATCH] Update to GA4 --- index.html | 11 +++++------ js/battleboat.js | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index a841ec5..30d2982 100644 --- a/index.html +++ b/index.html @@ -73,17 +73,16 @@

Enemy Fleet

Fork me on GitHub + diff --git a/js/battleboat.js b/js/battleboat.js index b85cf82..36f0683 100644 --- a/js/battleboat.js +++ b/js/battleboat.js @@ -76,13 +76,13 @@ Stats.prototype.wonGame = function() { this.gamesPlayed++; this.gamesWon++; if (!DEBUG_MODE) { - ga('send', 'event', 'gameOver', 'win', this.uuid); + gtag('event', 'gameOver', {'win': this.uuid}); } }; Stats.prototype.lostGame = function() { this.gamesPlayed++; if (!DEBUG_MODE) { - ga('send', 'event', 'gameOver', 'lose', this.uuid); + gtag('event', 'gameOver', {'lose': this.uuid}); } }; // Saves the game statistics to localstorage, also uploads where the user placed @@ -111,7 +111,7 @@ Stats.prototype.syncStats = function() { } if (!DEBUG_MODE) { - ga('send', 'event', 'humanGrid', stringifiedGrid, this.uuid); + gtag('event', 'humanGrid', {stringifiedGrid: this.uuid}); } }; // Updates the sidebar display with the current statistics