[object Object]

← back to CelebritySignatures

GA4 game_start: guard category param — only log when #catOpts visible (Cody gate fix, prevents junk dimension for 4/6 modes)

faf97c9bfaa40a3488be238ffa62f777ac75d12a · 2026-08-04 09:13:40 -0700 · Steve Abrams

Files touched

Diff

commit faf97c9bfaa40a3488be238ffa62f777ac75d12a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Aug 4 09:13:40 2026 -0700

    GA4 game_start: guard category param — only log when #catOpts visible (Cody gate fix, prevents junk dimension for 4/6 modes)
---
 public/assets/ga-events.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/public/assets/ga-events.js b/public/assets/ga-events.js
index 1685fb1..c861d2a 100644
--- a/public/assets/ga-events.js
+++ b/public/assets/ga-events.js
@@ -35,10 +35,14 @@
     if (gcard) { ev('game_mode_select', { mode: gcard.getAttribute('data-g') }); return; }
     if (t.closest('#goBtn')) {
       var pick = function (sel, attr) { var el = document.querySelector(sel); return el ? el.getAttribute(attr) : ''; };
+      // #catOpts is display:none for modes where category is irrelevant (art/match/early/lightning) —
+      // only log category when the control is actually visible, else GA4 accumulates a stale junk dimension.
+      var catOpts = document.querySelector('#catOpts');
+      var catVisible = catOpts && catOpts.style.display !== 'none';
       ev('game_start', {
         mode:       pick('.gcard.on[data-g]', 'data-g'),
         difficulty: pick('#diffOpts .opt.on[data-d]', 'data-d'),
-        category:   pick('#catOpts .opt.on[data-c]', 'data-c')
+        category:   catVisible ? pick('#catOpts .opt.on[data-c]', 'data-c') : ''
       });
       return;
     }

← e44e3a8 GA4 events: add game_start (mode/difficulty/category) + game  ·  back to CelebritySignatures  ·  payments(TEST): gate signature downloads behind Stripe check 0881033 →