Skip to content

Commit f9ab531

Browse files
update analytics.js file
1 parent f059351 commit f9ab531

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/js/analytics.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ export let trackEvent = (event, data) => {
55
console.log(data); // eslint-disable-line no-console
66
};
77

8-
if (typeof window.ga !== 'undefined') {
8+
if (typeof window.gtag !== 'undefined') {
99
trackEvent = (evt, data) => {
10-
window.ga(evt, data);
10+
window.gtag('event', evt, data);
1111
};
1212
}
1313

1414
export const trackElement = (el) => {
1515
return trackEvent('send', {
16-
hitType: 'event',
17-
eventCategory: el.getAttribute('data-ga-category') || '',
18-
eventAction: el.getAttribute('data-ga-action') || '',
19-
eventLabel: el.getAttribute('data-ga-label') || '',
16+
event_category: el.getAttribute('data-ga-category') || '',
17+
event_action: el.getAttribute('data-ga-action') || '',
18+
event_label: el.getAttribute('data-ga-label') || '',
2019
});
2120
};
2221

@@ -42,10 +41,9 @@ export default function initAnalytics() {
4241

4342
const afterPrint = () => {
4443
return trackEvent('send', {
45-
hitType: 'event',
46-
eventCategory: 'Print Intent',
47-
eventAction: 'Print Intent',
48-
eventLabel: window.location.pathname.split('/').slice(-3).join('/'),
44+
event_category: 'Print Intent',
45+
event_action: 'Print Intent',
46+
event_label: window.location.pathname.split('/').slice(-3).join('/'),
4947
});
5048
};
5149

0 commit comments

Comments
 (0)