ahoy
Simple, powerful, first-party analytics for Rails
What is ahoy?
Simple, powerful, first-party analytics for Rails
Overview of ahoy
What it is
Ahoy is a Ruby gem for Rails that provides simple, powerful, first-party analytics. It tracks visits and events in Ruby, JavaScript, and native apps. Data is stored in your database by default, and you can customize it for any data store as you grow. It is battle-tested at Instacart.
Key features
- Tracks visits with traffic source, location, technology, and UTM parameters.
- Tracks events with a name and properties from Ruby, JavaScript, native apps, and AMP.
- Automatically associates visits with models via
visitable. - Attaches the current user to visits, including with Devise and other authentication frameworks.
- Excludes bots by default, with options to include them or add custom exclusion rules.
- Supports geocoding via the Geocoder gem (optional).
- Provides GDPR compliance options.
- Allows customization of visit duration, visitor duration, cookies, token generation, and throttling.
Use cases
- Understand where website traffic comes from (referrer, domain, landing page, UTM parameters).
- Analyze user behavior by tracking custom events (e.g., “Viewed book”, “Ran action”).
- Associate orders or other models with visits to see conversion sources.
- Monitor user sessions and visitor tokens for session duration and repeat visits.
- Geocode IP addresses for location-based analytics (optional).
Getting started
Add this line to your application’s Gemfile: ruby gem 'ahoy_matey' And run: sh bundle install rails generate ahoy:install rails db:migrate Restart your web server, open a page in your browser, and a visit will be created. Track your first event from a controller with: ruby ahoy.track 'My first event', language: 'Ruby' For JavaScript, native apps, and AMP, see the repository README for detailed setup instructions.
License and pricing
The license is MIT. The project is open source.
Based on the project's public README and repository metadata.