OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
5 <title>User counter</title> | 5 <title>User counter</title> |
6 <style type="text/css"> | 6 <style type="text/css"> |
7 form | 7 form |
8 { | 8 { |
9 display: inline; | 9 display: inline; |
10 } | 10 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (days > 30) | 95 if (days > 30) |
96 continue; | 96 continue; |
97 | 97 |
98 var hits = intervals[interval].hits; | 98 var hits = intervals[interval].hits; |
99 for (var i = Math.max(offset, 0); i < data.length; i++) | 99 for (var i = Math.max(offset, 0); i < data.length; i++) |
100 { | 100 { |
101 if (i - offset < 30 && i - offset + days >= 30) | 101 if (i - offset < 30 && i - offset + days >= 30) |
102 data[i]["30day " + type] += hits; | 102 data[i]["30day " + type] += hits; |
103 if (i - offset < 7 && i - offset + days >= 7) | 103 if (i - offset < 7 && i - offset + days >= 7) |
104 data[i]["7day " + type] += hits; | 104 data[i]["7day " + type] += hits; |
| 105 if (i - offset < 1 && i - offset + days >= 1) |
| 106 data[i]["1day " + type] += hits; |
105 } | 107 } |
106 } | 108 } |
107 } | 109 } |
108 | 110 |
109 var month = zeroPad(date.getFullYear(), 4) + zeroPad(date.getMonth() + 1,
2); | 111 var month = zeroPad(date.getFullYear(), 4) + zeroPad(date.getMonth() + 1,
2); |
110 if (month != curMonth) | 112 if (month != curMonth) |
111 { | 113 { |
112 doDownload("/raw/subscription/" + month + "/exceptionrules.txt.json", "a
cceptable ads data for month " + month, function(json) | 114 doDownload("/raw/subscription/" + month + "/exceptionrules.txt.json", "a
cceptable ads data for month " + month, function(json) |
113 { | 115 { |
114 curMonthFilters = json; | 116 curMonthFilters = json; |
(...skipping 27 matching lines...) Expand all Loading... |
142 var resultBody = document.getElementById("resultBody"); | 144 var resultBody = document.getElementById("resultBody"); |
143 while (resultBody.lastChild) | 145 while (resultBody.lastChild) |
144 resultBody.removeChild(resultBody.lastChild); | 146 resultBody.removeChild(resultBody.lastChild); |
145 | 147 |
146 for (var i = 0; i < data.length; i++) | 148 for (var i = 0; i < data.length; i++) |
147 { | 149 { |
148 var date = new Date(fromDate.getTime() + i * MILLIS_IN_DAY); | 150 var date = new Date(fromDate.getTime() + i * MILLIS_IN_DAY); |
149 | 151 |
150 var row = document.createElement("tr"); | 152 var row = document.createElement("tr"); |
151 createCell(row, date.toLocaleDateString()); | 153 createCell(row, date.toLocaleDateString()); |
| 154 createCell(row, data[i]["1day total"].toLocaleString()); |
| 155 createCell(row, data[i]["1day acceptable"].toLocaleString()); |
| 156 createCell(row, (100 - data[i]["1day acceptable"] / data[i]["1day total"
] * 100).toFixed(2) + "%"); |
152 createCell(row, data[i]["7day total"].toLocaleString()); | 157 createCell(row, data[i]["7day total"].toLocaleString()); |
153 createCell(row, data[i]["7day acceptable"].toLocaleString()); | 158 createCell(row, data[i]["7day acceptable"].toLocaleString()); |
154 createCell(row, (100 - data[i]["7day acceptable"] / data[i]["7day total"
] * 100).toFixed(2) + "%"); | 159 createCell(row, (100 - data[i]["7day acceptable"] / data[i]["7day total"
] * 100).toFixed(2) + "%"); |
155 createCell(row, data[i]["30day total"].toLocaleString()); | 160 createCell(row, data[i]["30day total"].toLocaleString()); |
156 createCell(row, data[i]["30day acceptable"].toLocaleString()); | 161 createCell(row, data[i]["30day acceptable"].toLocaleString()); |
157 createCell(row, (100 - data[i]["30day acceptable"] / data[i]["30day tota
l"] * 100).toFixed(2) + "%"); | 162 createCell(row, (100 - data[i]["30day acceptable"] / data[i]["30day tota
l"] * 100).toFixed(2) + "%"); |
158 resultBody.appendChild(row); | 163 resultBody.appendChild(row); |
159 } | 164 } |
160 | 165 |
161 document.getElementById("result").removeAttribute("hidden"); | 166 document.getElementById("result").removeAttribute("hidden"); |
(...skipping 27 matching lines...) Expand all Loading... |
189 | 194 |
190 if (fromDate > toDate) | 195 if (fromDate > toDate) |
191 { | 196 { |
192 var tmp = fromDate; | 197 var tmp = fromDate; |
193 fromDate = toDate; | 198 fromDate = toDate; |
194 toDate = tmp; | 199 toDate = tmp; |
195 } | 200 } |
196 | 201 |
197 var data = []; | 202 var data = []; |
198 for (var d = fromDate; formatDate(d) <= formatDate(toDate); d = new Date(d
.getTime() + MILLIS_IN_DAY)) | 203 for (var d = fromDate; formatDate(d) <= formatDate(toDate); d = new Date(d
.getTime() + MILLIS_IN_DAY)) |
199 data.push({"7day total": 0, "7day acceptable": 0, "30day total": 0, "30d
ay acceptable": 0}); | 204 data.push({"1day total": 0, "1day acceptable": 0, "7day total": 0, "7day
acceptable": 0, "30day total": 0, "30day acceptable": 0}); |
200 | 205 |
201 var offset = -30; | 206 var offset = -30; |
202 var callback = function() | 207 var callback = function() |
203 { | 208 { |
204 offset++; | 209 offset++; |
205 if (offset >= data.length) | 210 if (offset >= data.length) |
206 { | 211 { |
207 showResults(fromDate, data); | 212 showResults(fromDate, data); |
208 return; | 213 return; |
209 } | 214 } |
(...skipping 21 matching lines...) Expand all Loading... |
231 <span class="spacer"></span> | 236 <span class="spacer"></span> |
232 <button type="submit">Calculate</button> | 237 <button type="submit">Calculate</button> |
233 </form> | 238 </form> |
234 </p> | 239 </p> |
235 <p id="wait" hidden> | 240 <p id="wait" hidden> |
236 Please wait, data is being fetched... | 241 Please wait, data is being fetched... |
237 </p> | 242 </p> |
238 <table id="result" hidden> | 243 <table id="result" hidden> |
239 <tr> | 244 <tr> |
240 <th rowspan="2">Date</th> | 245 <th rowspan="2">Date</th> |
| 246 <th colspan="3">1-day active users</th> |
241 <th colspan="3">7-day active users</th> | 247 <th colspan="3">7-day active users</th> |
242 <th colspan="3">30-day active users</th> | 248 <th colspan="3">30-day active users</th> |
243 </tr> | 249 </tr> |
244 <tr> | 250 <tr> |
245 <th>Total</th> | 251 <th>Total</th> |
246 <th>Acceptable ads</th> | 252 <th>Acceptable ads</th> |
247 <th>Opt-out rate</th> | 253 <th>Opt-out rate</th> |
248 <th>Total</th> | 254 <th>Total</th> |
249 <th>Acceptable ads</th> | 255 <th>Acceptable ads</th> |
250 <th>Opt-out rate</th> | 256 <th>Opt-out rate</th> |
251 </tr> | 257 </tr> |
252 <tbody id="resultBody"> | 258 <tbody id="resultBody"> |
253 </tbody> | 259 </tbody> |
254 </table> | 260 </table> |
255 </body> | 261 </body> |
256 </html> | 262 </html> |
OLD | NEW |