I would like to build a simple analytics section for a Rails 4.2 app. I consider using Ahoy gem that can store Visits and Events.
I already managed to display a line-graphic the number of visitors using kickchart. For today`s visits example:
Visit.group_by_hour(:started_at, range: Date.today..Time.now, timezone: "Central Time", format: "%I:%M %P").count
Like this I have working: Month, Yesterday and Week visitors. But I was asked to show the recurrent visitors and the new visitors. Ahoy gem creates a visitor_id like UUID in the database. So with this I can know which visitor is returning and which is new.
I don`t know how to retrieve this data and group it so I can display it in kickchart. I need today, yesterday, this week and this month recurrent and new visitors.
The gems I'm using: groupdate, ahoy and kickchart
Database: PostgreSQL 9.4