针对 Ruby on Rails 应用程序的第一方、以隐私为核心的流量分析。
Simple traffic analytics for the win of privacy.
ActiveAnalytics is a Rails engine directly mountable in your Ruby on Rails application. It doesn't reveal anything about specific visitors. It cannot be blocked by adblockers or other privacy-protecting extensions (and doesn't need to).
ActiveAnalytics lets you know about:
Add this line to your application's Gemfile:
gem 'active_analytics'Then execute bundle and run the migration:
bundle
rails active_analytics:install:migrations
rails db:migrateAdd the route to ActiveAnalytics dashboard at the desired endpoint:
# config/routes.rb
mount ActiveAnalytics::Engine, at: "analytics" # http://localhost:3000/analyticsBy default ActiveAnalytics will extend ActionController::Base, but you can specify a custom base controller for the ActiveAnalytics dashboard:
# config/initializers/active_analytics.rb
Rails.application.configure do
ActiveAnalytics.base_controller_class = "AdminController"
endThe next step is to collect trafic and there is 2 options.
This is the easiest way to start with.
However it's less performant since it triggers a write into your database for each request.
Your controllers have to call ActiveAnalytics.record_request(request) to record page views.
The Rails way to achieve is to use after_action :
class ApplicationController (u) { u.admin? } do # Supposing there is a User#admin? method
mount ActiveAnalytics::Engine, at: "analytics" # http://localhost:3000/analytics
endThe gem is available as open-source under the terms of the MIT License.
Made by Base Secrète.
Rails developer? Check out RoRvsWild, our Ruby on Rails application monitoring tool.
暂无开放 Issues,或尚未同步最近议题。