From b5fbd54c96c69736ba6a848617a306538db06b1e Mon Sep 17 00:00:00 2001 From: Jeff Reiffers Date: Fri, 27 Sep 2024 08:06:50 +0200 Subject: [PATCH] fix: track events --- src/components/analytics-siteimprove/utils.ts | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/analytics-siteimprove/utils.ts b/src/components/analytics-siteimprove/utils.ts index 5a2f576f4..712b781aa 100644 --- a/src/components/analytics-siteimprove/utils.ts +++ b/src/components/analytics-siteimprove/utils.ts @@ -12,17 +12,19 @@ type SiteImproveEventProps = { label?: string | undefined; }; -export const trackSiteImproveEvent = - ({ category, action, label }: SiteImproveEventProps) => - () => { - if (window._sz === undefined) { - // eslint-disable-next-line no-console - console.error('Unable to find Site Improve event library.'); - } +export const trackSiteImproveEvent = ({ + category, + action, + label +}: SiteImproveEventProps) => { + if (window._sz === undefined) { + // eslint-disable-next-line no-console + console.error('Unable to find Site Improve event library.'); + } - if (label) { - window._sz.push(['event', category, action, label]); - } else { - window._sz.push(['event', category, action]); - } - }; + if (label) { + window._sz.push(['event', category, action, label]); + } else { + window._sz.push(['event', category, action]); + } +};