show monthly page views

This commit is contained in:
barisusakli
2014-12-20 20:05:59 -05:00
parent b07a522c60
commit 94cf29d42c
5 changed files with 57 additions and 18 deletions

View File

@@ -45,6 +45,10 @@ var cronJob = require('cron').CronJob,
if (pageViews > 0) {
db.sortedSetIncrBy('analytics:pageviews', pageViews, today.getTime());
var month = new Date();
month.setMonth(month.getMonth(), 1);
month.setHours(0, 0, 0, 0);
db.sortedSetIncrBy('analytics:pageviews:month', pageViews, month.getTime());
pageViews = 0;
}