Skip to content

Commit

Permalink
Merge pull request #112 from dfe-analytical-services/google_analytics
Browse files Browse the repository at this point in the history
Adding in more google analytics tracking for domain tabs
  • Loading branch information
yauemily authored Oct 21, 2024
2 parents bf3c710 + 031a588 commit 9fe1085
Show file tree
Hide file tree
Showing 2 changed files with 602 additions and 713 deletions.
50 changes: 50 additions & 0 deletions google-analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,57 @@
});
});

/*
Adding in custom google analytics tracking for the domain tabs
*/

$(document).on('click', 'ul#outcome1_panels', function(e) {
gtag('event', 'Outcome1 Domains', {'event_category' : 'O1 Domain clicks',
'event_label' : document.querySelector(
'ul#outcome1_panels > li.active > a'
).getAttribute('data-value')
});
});

$(document).on('click', 'ul#outcome2_panels', function(e) {
gtag('event', 'Outcome2 Domains', {'event_category' : 'O2 Domain clicks',
'event_label' : document.querySelector(
'ul#outcome2_panels > li.active > a'
).getAttribute('data-value')
});
});

$(document).on('click', 'ul#outcome3_panels', function(e) {
gtag('event', 'Outcome3 Domains', {'event_category' : 'O3 Domain clicks',
'event_label' : document.querySelector(
'ul#outcome3_panels > li.active > a'
).getAttribute('data-value')
});
});

$(document).on('click', 'ul#outcome4_panels', function(e) {
gtag('event', 'Outcome4 Domains', {'event_category' : 'O4 Domain clicks',
'event_label' : document.querySelector(
'ul#outcome4_panels > li.active > a'
).getAttribute('data-value')
});
});

$(document).on('click', 'ul#enabler2_panels', function(e) {
gtag('event', 'Enabler2 Domains', {'event_category' : 'E2 Domain clicks',
'event_label' : document.querySelector(
'ul#enabler2_panels > li.active > a'
).getAttribute('data-value')
});
});

$(document).on('click', 'ul#enabler3_panels', function(e) {
gtag('event', 'Enabler3 Domains', {'event_category' : 'E3 Domain clicks',
'event_label' : document.querySelector(
'ul#enabler3_panels > li.active > a'
).getAttribute('data-value')
});
});

</script>

Expand Down
Loading

0 comments on commit 9fe1085

Please sign in to comment.