I've currently installed a plugin (http://ift.tt/1oa6jQo)
Wich does the tracking thing, only I want to get unique visitors. I reall don't know how to extract those from this package. Or how I should make one by my own.
I want them to return as a json object per month.
If someone could help me out with this?
I tried it using the tracker_sessions
table, but that doesn't work well.
Route::get('admin/api', function(){
$stats = DB::table('tracker_sessions')
->groupBy('created_at')
->orderBy('created_at', 'ASC')
->get([
DB::raw('created_at as y'),
DB::raw('COUNT(*) as b')
]);
return json_encode($stats);
});
That returns something like this:
[{"y":"2016-05-22 21:17:17","b":1},{"y":"2016-05-22 21:17:27","b":1},{"y":"2016-05-22 21:17:28","b":2},{"y":"2016-05-22 21:17:29","b":1},{"y":"2016-05-22 21:17:31","b":1},{"y":"2016-05-22 21:17:33","b":1},{"y":"2016-05-22 21:18:10","b":1},{"y":"2016-05-22 21:18:11","b":2},{"y":"2016-05-22 21:18:13","b":1}]
Wich is not good at all...
Can someone please help me out?
Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire