forked from nteract/nteract.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gtag.js
33 lines (30 loc) · 851 Bytes
/
gtag.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// nteract.io's GA Tracking ID (I just set this up)
export const GA_TRACKING_ID = "UA-129108362-1";
/**
* pages/_document.js will load the google analytics adapter and use
* nteract.io's tracking ID above.
*
* The following functions are helpers for submitting events and page views
*
* Usage:
* gtag.event({
* action: 'clone',
* category: 'workflow',
* label: 'test'
* })
*
*/
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
export const pageview = url => {
window.gtag("config", GA_TRACKING_ID, {
page_location: url
});
};
// https://developers.google.com/analytics/devguides/collection/gtagjs/events
export const event = ({ action, category, label, value }) => {
window.gtag("event", action, {
event_category: category,
event_label: label,
value: value
});
};