From 5ccfa654ecc8c88facfdc549c51cf2f687ae0e6b Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Wed, 10 May 2023 01:18:23 +0100 Subject: [PATCH] Add support for custom labels in ga --- src/components/PageSponsor.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/PageSponsor.tsx b/src/components/PageSponsor.tsx index a0d3cc7cb..f77f64251 100644 --- a/src/components/PageSponsor.tsx +++ b/src/components/PageSponsor.tsx @@ -7,6 +7,7 @@ import { sponsorHidden } from '../stores/page'; export type PageSponsorType = { company: string; description: string; + gaLabel: string; imageUrl: string; pageUrl: string; title: string; @@ -49,7 +50,9 @@ export function PageSponsor(props: PageSponsorProps) { window.fireEvent({ category: 'SponsorImpression', action: `${response.sponsor?.company} Impression`, - label: `${gaPageIdentifier} / ${response.sponsor?.company} Link`, + label: + response.sponsor.gaLabel || + `${gaPageIdentifier} / ${response.sponsor?.company} Link`, }); }; @@ -61,7 +64,8 @@ export function PageSponsor(props: PageSponsorProps) { return null; } - const { url, title, imageUrl, description, company, pageUrl } = sponsor; + const { url, title, imageUrl, description, company, gaLabel, pageUrl } = + sponsor; return (