-
Notifications
You must be signed in to change notification settings - Fork 101
/
Copy pathg-analytics.js
137 lines (104 loc) · 3.9 KB
/
g-analytics.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-170240821-2');
$(document).on('shiny:inputchanged', function(event) {
if (event.name == 'select.county.rt') {
gtag('event', event.name, {
'event_action': 'select_county_reff',
'event_category': 'Nowcasts',
'event_label': event.value
});
}
if (event.name == 'select.county.hosp') {
gtag('event', event.name, {
'event_action': 'select_county_hosp_forecasts',
'event_category': 'Forecasts',
'event_label': event.value
});
}
if (event.name == 'select.county.death') {
gtag('event', event.name, {
'event_action': 'select_county_death_forecasts',
'event_category': 'Forecasts',
'event_label': event.value
});
}
if (event.name == 'county_ts') {
gtag('event', event.name, {
'event_action': 'select_county_4_scenarios',
'event_category': 'Scenarios',
'event_label': event.value
});
}
if (event.name == 'selected_crosswalk') {
gtag('event', event.name, {
'event_action': 'select_outcomes',
'event_category': 'Scenarios',
'event_label': event.value
});
}
});
$(document).on('click','button#Rt_explain.btn.btn-default.action-button.shiny-bound-input', function() {
gtag('event', 'Rt.button', {
'event_action': 'Button',
'event_category': 'Nowcasts',
'event_label': 'Rt.button'
});
});
$(document).on('click', 'a#dlRt.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'Rt_state_download', {
'event_action': 'Download',
'event_category': 'Nowcasts',
'event_label': 'Rt_state'
});
});
$(document).on('click', 'a#dlRt.indv.cnty.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'Rt_county_download', {
'event_action': 'Download',
'event_category': 'Nowcasts',
'event_label': 'Rt_county'
});
});
$(document).on('click', 'a#dlRt.cnty.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'Rt_cnty_dot_plot_download', {
'event_action': 'Download',
'event_category': 'Nowcasts',
'event_label': 'Rt_county_dot_plot'
});
});
$(document).on('click', 'a#dlRt.cnty.map.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'Rt_map_download', {
'event_action': 'Download',
'event_category': 'Nowcasts',
'event_label': 'Rt_map'
});
});
$(document).on('click', 'a#dlhosp.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'state_hosp_forecasts', {
'event_action': 'Download',
'event_category': 'Forecasts',
'event_label': 'state_hosp_forecasts'
});
});
$(document).on('click', 'a#dlhosp.cnty.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'county_hosp_forecasts', {
'event_action': 'Download',
'event_category': 'Forecasts',
'event_label': 'county_hosp_forecasts'
});
});
$(document).on('click', 'a#dlDeath.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'state_death_forecasts', {
'event_action': 'Download',
'event_category': 'Forecasts',
'event_label': 'state_death_forecasts'
});
});
$(document).on('click', 'a#dlDeath.cnty.btn.btn-default.shiny-download-link.shiny-bound-output', function() {
gtag('event', 'county_death_forecasts', {
'event_action': 'Download',
'event_category': 'Forecasts',
'event_label': 'county_death_forecasts'
});
});