Skip to content

Commit

Permalink
fix: track events
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Sep 27, 2024
1 parent b87ba61 commit b5fbd54
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/components/analytics-siteimprove/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
};

0 comments on commit b5fbd54

Please sign in to comment.