1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-02-25 12:03:17 +01:00
2019-11-16 15:21:40 +04:00

26 lines
638 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
export const firePageView = url => {
if (!window.gtag) {
console.warn('Missing GTAG Analytics disabled');
return;
}
window.gtag('config', process.env.GA_SECRET, {
page_path: url,
})
};
// https://developers.google.com/analytics/devguides/collection/gtagjs/events
export const event = ({ action, category, label, value }) => {
if (!window.gtag) {
console.warn('Missing GTAG Analytics disabled');
return;
}
window.gtag('event', action, {
event_category: category,
event_label: label,
value: value,
})
};