📊 Simple Admin Panel for ahoy analytics and Rails.
WARNING: Despite the fact that it's been running in production for a while, this is still a beta software.
- 📅 Analytics for different time periods today/last-24hr/yesterday/this-week/last-7-days/this-month etc..
- 📈 Beatiful and lightweight charts with uPlot
- 💪 Caching for heavy DB queries and templates
- 📊 Top pages/bots/devices/countries etc...
- 🚤 Lightweight, Mobile friendly UI
The live demo is located here
- PostgreSQL support only at this moment
gem "ahoy_admin", git: "https://github.com/followerstracker/ahoy_admin"
Add mounting to the routes (config/routes.rb)
mount(AhoyAdmin::Engine, at: "/ahoy")
Add a configuration to initializers, config/initializers/ahoy_admin.rb
:
AhoyAdmin.configure do |config|
config.brand_name = "Ahoy Admin"
config.current_user_admin = lambda { |user| user&.admin? || Rails.env.development? }
config.current_user_method = :current_user
config.domains = []
config.head_favicon_url = "/favicon.ico"
config.head_meta_description = "Ahoy Admin Panel"
config.head_meta_keywords = "ahoy, admin, panel, analytics"
config.head_meta_noindex = false
config.head_title = "Ahoy Admin"
config.time_zone = "UTC"
config.widgets = %w[
views_by_page
visits_by_bot
visits_by_country
visits_by_device
visits_by_referrer
]
end
By default ahoy gem doesn't track bots. We think that information could be useful, tracked and analyzed.
In order to enable this functionality, you might want to create a migration and to add the bot
column to ahoy_visits table:
disable_ddl_transaction!
def change
add_column(:ahoy_visits, :bot, :string)
add_index(:ahoy_visits, :bot, algorithm: :concurrently)
end
Now we need to change the way we populate that column:
class Ahoy::Store < Ahoy::DatabaseStore
def track_visit(data)
data[:bot] = DeviceDetector.new(request.user_agent).send(:bot)&.send(:regex_meta).try(:[], :name)
super(data)
end
end
This should be enough to see reports for bots.
Yeah, there are no tests yet. Stay tuned.
TBD
The gem is available as open source under the terms of the MIT License.