mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-11 03:34:00 +02:00
Add support for custom labels in ga
This commit is contained in:
@@ -7,6 +7,7 @@ import { sponsorHidden } from '../stores/page';
|
|||||||
export type PageSponsorType = {
|
export type PageSponsorType = {
|
||||||
company: string;
|
company: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
gaLabel: string;
|
||||||
imageUrl: string;
|
imageUrl: string;
|
||||||
pageUrl: string;
|
pageUrl: string;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -49,7 +50,9 @@ export function PageSponsor(props: PageSponsorProps) {
|
|||||||
window.fireEvent({
|
window.fireEvent({
|
||||||
category: 'SponsorImpression',
|
category: 'SponsorImpression',
|
||||||
action: `${response.sponsor?.company} Impression`,
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { url, title, imageUrl, description, company, pageUrl } = sponsor;
|
const { url, title, imageUrl, description, company, gaLabel, pageUrl } =
|
||||||
|
sponsor;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
@@ -73,7 +77,7 @@ export function PageSponsor(props: PageSponsorProps) {
|
|||||||
window.fireEvent({
|
window.fireEvent({
|
||||||
category: 'SponsorClick',
|
category: 'SponsorClick',
|
||||||
action: `${company} Redirect`,
|
action: `${company} Redirect`,
|
||||||
label: `${gaPageIdentifier} / ${company} Link`,
|
label: gaLabel || `${gaPageIdentifier} / ${company} Link`,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Reference in New Issue
Block a user