From 721479b34668cb1bdfe2e312a86c04f08cd5d659 Mon Sep 17 00:00:00 2001 From: Kathryn Middleton Date: Tue, 7 Nov 2023 09:36:55 -0500 Subject: [PATCH] Check for value before passing to gtag (#6415) --- 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 86fc91350..b36112c47 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, }); }