From 464c91d86fbb9b6f5fdb01b75636b589347ce395 Mon Sep 17 00:00:00 2001 From: Kathryn Middleton Date: Mon, 6 Nov 2023 23:28:30 +0000 Subject: [PATCH] Check for value before passing to gtag --- src/components/Layout/Feedback.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index 86fc91350a9..b36112c4718 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -45,13 +45,14 @@ const thumbsDownIcon = ( ); function sendGAEvent(isPositive: boolean) { + const value = isPositive ? 1 : 0; // Fragile. Don't change unless you've tested the network payload // and verified that the right events actually show up in GA. // @ts-ignore gtag('event', 'feedback', { event_category: 'button', event_label: window.location.pathname, - value: isPositive ? 1 : 0, + value, }); }