1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-01-18 06:38:34 +01:00

Add support for custom labels in ga

This commit is contained in:
Kamran Ahmed 2023-05-10 01:18:23 +01:00
parent 1c67068eab
commit 5ccfa654ec

View File

@ -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 (
<a
@ -73,7 +77,7 @@ export function PageSponsor(props: PageSponsorProps) {
window.fireEvent({
category: 'SponsorClick',
action: `${company} Redirect`,
label: `${gaPageIdentifier} / ${company} Link`,
label: gaLabel || `${gaPageIdentifier} / ${company} Link`,
});
}}
>