-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-analytics.html
95 lines (78 loc) · 2.89 KB
/
google-analytics.html
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<script>
// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Default ad_storage to 'denied' as a placeholder
// Determine actual values based on your own requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied'
});
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Q13T4ENF6C"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
/*
The tracking number below MUST be replaced with a unique number, contact the statistics development team to set this up.
*/
gtag('config', 'G-Q13T4ENF6C');
$(document).on('click', 'ul#navlistPanel', function(e) {
gtag('event', 'navlistPanel', {'event_category' : 'navbar click',
'event_label' : document.querySelector('ul#navlistPanel > li.active > a').getAttribute('data-value')
});
});
$(document).on('shiny:disconnected', function(e) {
gtag('event', 'disconnect', {
'event_label' : 'Disconnect',
'event_category' : 'Disconnect'
});
});
/*
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>