mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
18 lines
529 B
TypeScript
18 lines
529 B
TypeScript
export const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_ID;
|
|
|
|
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
|
export const pageview = (url: any) => {
|
|
(window as any).gtag("config", GA_TRACKING_ID, {
|
|
page_path: url,
|
|
});
|
|
};
|
|
|
|
// https://developers.google.com/analytics/devguides/collection/gtagjs/events
|
|
export const event = ({ action, category, label, value }: any) => {
|
|
(window as any).gtag("event", action, {
|
|
event_category: category,
|
|
event_label: label,
|
|
value: value,
|
|
});
|
|
};
|