Report Building
-
Has anyone worked on extending (internally or externally) the reports around views, users, posts, etc? In the dashboard we get great info about these numbers over the past 24 hours, but what if we need then by week, month, year and extending back a long time? Is there anything existing today for that and, if not, would there be good queries to use to pull out that data so that it can be built?
I'd be perfectly happy if this was a plugin or even an external site just accessing the database. Doesn't have to be fancy, just want to get some read-only numbers to learn more about the site traffic and am just beginning to look into the best way to do it.
-
I plan to update the dashboard for 1.0 so that you can change the period from past 24 hours to past week/month etc. We already store the data so it is just a matter of displaying it.
For now you can retrieve the pageviews for a particular period with the below mongodb query. Just replace the
$gte
and$lte
with timestamps of the hours.db.objects.find({_key:"analytics:pageviews", value: {$gte:"1443657600000", $lte:"1443657600000"}})
The score fields in the return are the pageviews.
-
@julian said:
The data is stored on an hourly basis, and can be queried back for as long as those metrics have been recorded.
You can search the database for the key
analytics:*
How far back have the stats been stored (meaning version numbers.) We've been on the same database since March, 2014.
-
@baris said:
I plan to update the dashboard for 1.0 so that you can change the period from past 24 hours to past week/month etc. We already store the data so it is just a matter of displaying it.
That will be awesome, we've long wanted it but it was just a nicety. Suddenly we need the data with no warning so having it all handy and pretty would be great
-
Looks like we updated promptly, we have 9859 hours of data!!
Posted a small "how to" for people:
http://mangolassi.it/topic/6960/accessing-view-data-from-mongodb-for-nodebb