Skip to content

Commit

Permalink
Update GA implementation (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccar authored Mar 26, 2024
1 parent f7ced7c commit 8d6239b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ export let trackEvent = () => {};
if (window.google_tag_manager !== undefined) {
console.log('GA active');
trackEvent = (type, data) => {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('event', type, { ...data });
console.log('Data sent to Data Layer');
};
Expand All @@ -17,7 +13,7 @@ if (window.google_tag_manager !== undefined) {
}

export const trackElement = (el, type) => {
return trackEvent(type, {
return trackEvent(`ons_${type}`, {
event_category: el.getAttribute('data-ga-category') || '',
event_action: el.getAttribute('data-ga-action') || '',
event_label: el.getAttribute('data-ga-label') || '',
Expand Down

0 comments on commit 8d6239b

Please sign in to comment.