Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/statsmaster/files/usercounts.html

Issue 4811406654308352: Issue 763 - Count the number of users for the anti-adblock filters (Closed)
Patch Set: Created July 9, 2014, 1 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/statsmaster/files/usercounts.html
===================================================================
--- a/modules/statsmaster/files/usercounts.html
+++ b/modules/statsmaster/files/usercounts.html
@@ -43,16 +43,17 @@
function formatDate(date)
{
return zeroPad(date.getFullYear(), 4) + "-" + zeroPad(date.getMonth() + 1, 2) + "-" + zeroPad(date.getDate(), 2);
}
var curMonth = null;
var curMonthFilters = null;
+ var curMonthAntiadblock = null;
var curMonthNotifications = null;
function checkStats(data, fromDate, offset, callback)
{
var date = new Date(fromDate.getTime() + offset * MILLIS_IN_DAY);
function doDownload(url, descr, callback)
{
@@ -109,29 +110,35 @@
}
var month = zeroPad(date.getFullYear(), 4) + zeroPad(date.getMonth() + 1, 2);
if (month != curMonth)
{
doDownload("/raw/subscription/" + month + "/exceptionrules.txt.json", "acceptable ads data for month " + month, function(json)
{
curMonthFilters = json;
- doDownload("/raw/notification/" + month + "/notification.json.json", "notification data for month " + month, function(json)
+ doDownload("/raw/subscription/" + month + "/antiadblockfilters.txt.json", "anti-adblock data for month " + month, function(json)
{
- curMonthNotifications = json;
- curMonth = month;
- doCheckStats(curMonthFilters, "acceptable");
- doCheckStats(curMonthNotifications, "total");
- callback();
+ curMonthAntiadblock = json;
+ doDownload("/raw/notification/" + month + "/notification.json.json", "notification data for month " + month, function(json)
+ {
+ curMonthNotifications = json;
+ curMonth = month;
+ doCheckStats(curMonthFilters, "acceptable");
+ doCheckStats(curMonthAntiadblock, "antiadblock");
+ doCheckStats(curMonthNotifications, "total");
+ callback();
+ });
});
});
}
else
{
doCheckStats(curMonthFilters, "acceptable");
+ doCheckStats(curMonthAntiadblock, "antiadblock");
doCheckStats(curMonthNotifications, "total");
callback();
}
}
function showResults(fromDate, data)
{
function createCell(row, text)
@@ -147,22 +154,25 @@
for (var i = 0; i < data.length; i++)
{
var date = new Date(fromDate.getTime() + i * MILLIS_IN_DAY);
var row = document.createElement("tr");
createCell(row, date.toLocaleDateString());
createCell(row, data[i]["1day total"].toLocaleString());
+ createCell(row, data[i]["1day antiadblock"].toLocaleString());
createCell(row, data[i]["1day acceptable"].toLocaleString());
createCell(row, (100 - data[i]["1day acceptable"] / data[i]["1day total"] * 100).toFixed(2) + "%");
createCell(row, data[i]["7day total"].toLocaleString());
+ createCell(row, data[i]["7day antiadblock"].toLocaleString());
createCell(row, data[i]["7day acceptable"].toLocaleString());
createCell(row, (100 - data[i]["7day acceptable"] / data[i]["7day total"] * 100).toFixed(2) + "%");
createCell(row, data[i]["30day total"].toLocaleString());
+ createCell(row, data[i]["30day antiadblock"].toLocaleString());
createCell(row, data[i]["30day acceptable"].toLocaleString());
createCell(row, (100 - data[i]["30day acceptable"] / data[i]["30day total"] * 100).toFixed(2) + "%");
resultBody.appendChild(row);
}
document.getElementById("result").removeAttribute("hidden");
document.getElementById("wait").setAttribute("hidden", "hidden");
}
@@ -196,17 +206,17 @@
{
var tmp = fromDate;
fromDate = toDate;
toDate = tmp;
}
var data = [];
for (var d = fromDate; formatDate(d) <= formatDate(toDate); d = new Date(d.getTime() + MILLIS_IN_DAY))
- data.push({"1day total": 0, "1day acceptable": 0, "7day total": 0, "7day acceptable": 0, "30day total": 0, "30day acceptable": 0});
+ data.push({"1day total": 0, "1day antiadblock": 0, "1day acceptable": 0, "7day total": 0, "7day antiadblock": 0, "7day acceptable": 0, "30day total": 0, "30day antiadblock": 0, "30day acceptable": 0});
var offset = -30;
var callback = function()
{
offset++;
if (offset >= data.length)
{
showResults(fromDate, data);
@@ -238,25 +248,31 @@
</form>
</p>
<p id="wait" hidden>
Please wait, data is being fetched...
</p>
<table id="result" hidden>
<tr>
<th rowspan="2">Date</th>
- <th colspan="3">1-day active users</th>
- <th colspan="3">7-day active users</th>
- <th colspan="3">30-day active users</th>
+ <th colspan="4">1-day active users</th>
+ <th colspan="4">7-day active users</th>
+ <th colspan="4">30-day active users</th>
</tr>
<tr>
<th>Total</th>
+ <th>Anti-adblock filters</th>
<th>Acceptable ads</th>
<th>Opt-out rate</th>
<th>Total</th>
+ <th>Anti-adblock filters</th>
+ <th>Acceptable ads</th>
+ <th>Opt-out rate</th>
+ <th>Total</th>
+ <th>Anti-adblock filters</th>
<th>Acceptable ads</th>
<th>Opt-out rate</th>
</tr>
<tbody id="resultBody">
</tbody>
</table>
</body>
</html>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld