-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathkeen.dashboard.js
161 lines (148 loc) · 3.93 KB
/
keen.dashboard.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
var client = new Keen({
projectId: "5368fa5436bf5a5623000000",
readKey: "3f324dcb5636316d6865ab0ebbbbc725224c7f8f3e8899c7733439965d6d4a2c7f13bf7765458790bd50ec76b4361687f51cf626314585dc246bb51aeb455c0a1dd6ce77a993d9c953c5fc554d1d3530ca5d17bdc6d1333ef3d8146a990c79435bb2c7d936f259a22647a75407921056"
});
Keen.ready(function(){
// ----------------------------------------
// Pageviews Area Chart
// ----------------------------------------
var pageviews_timeline = new Keen.Query("count", {
eventCollection: "pageviews",
interval: "hourly",
groupBy: "user.device_info.browser.family",
timeframe: {
start: "2014-05-04T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(pageviews_timeline, document.getElementById("chart-01"), {
chartType: "areachart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "85%",
left: "5%",
top: "5%",
width: "80%"
},
isStacked: true
}
});
// ----------------------------------------
// Pageviews Pie Chart
// ----------------------------------------
var pageviews_static = new Keen.Query("count", {
eventCollection: "pageviews",
groupBy: "user.device_info.browser.family",
timeframe: {
start: "2014-05-01T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(pageviews_static, document.getElementById("chart-02"), {
chartType: "piechart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "85%",
left: "5%",
top: "5%",
width: "100%"
}
}
});
// ----------------------------------------
// Impressions timeline
// ----------------------------------------
var impressions_timeline = new Keen.Query("count", {
eventCollection: "impressions",
groupBy: "ad.advertiser",
interval: "hourly",
timeframe: {
start: "2014-05-04T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(impressions_timeline, document.getElementById("chart-03"), {
chartType: "columnchart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "75%",
left: "10%",
top: "5%",
width: "60%"
},
bar: {
groupWidth: "85%"
},
isStacked: true
}
});
// ----------------------------------------
// Impressions timeline (device)
// ----------------------------------------
var impressions_timeline_by_device = new Keen.Query("count", {
eventCollection: "impressions",
groupBy: "user.device_info.device.family",
interval: "hourly",
timeframe: {
start: "2014-05-04T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(impressions_timeline_by_device, document.getElementById("chart-04"), {
chartType: "columnchart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "75%",
left: "10%",
top: "5%",
width: "60%"
},
bar: {
groupWidth: "85%"
},
isStacked: true
}
});
// ----------------------------------------
// Impressions timeline (country)
// ----------------------------------------
var impressions_timeline_by_country = new Keen.Query("count", {
eventCollection: "impressions",
groupBy: "user.geo_info.country",
interval: "hourly",
timeframe: {
start: "2014-05-04T00:00:00.000Z",
end: "2014-05-05T00:00:00.000Z"
}
});
client.draw(impressions_timeline_by_country, document.getElementById("chart-05"), {
chartType: "columnchart",
title: false,
height: 250,
width: "auto",
chartOptions: {
chartArea: {
height: "75%",
left: "10%",
top: "5%",
width: "60%"
},
bar: {
groupWidth: "85%"
},
isStacked: true
}
});
});