-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Won
committed
Sep 13, 2020
1 parent
c6f410a
commit e441f74
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const GA_TRACKING_ID = process.env.NEXT_PUBLIC_ANALYTICS_ID; | ||
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages | ||
export { pageView, event }; | ||
|
||
const pageView = (url) => { | ||
window.gtag('config', GA_TRACKING_ID, { | ||
page_path: url, | ||
}); | ||
}; | ||
|
||
// https://developers.google.com/analytics/devguides/collection/gtagjs/events | ||
const event = ({ action, category, label, value }) => { | ||
window.gtag('event', action, { | ||
event_category: category, | ||
event_label: label, | ||
value: value, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
interface Window { | ||
gtag: any; | ||
} |