Ruby gem for Rails that records visits and custom events in your database. JavaScript and native mobile clients can post analytics through an API.
Overview
Ahoy adds first-party analytics to Rails applications without sending traffic to third-party hosts by default. When someone loads a page, it creates a visit capturing referrer, landing page, location, device technology, and UTM parameters.
Events are named actions with optional properties. You can track from controllers in Ruby, from Ahoy.js in the browser, from native iOS and Android companion libraries, or from AMP pages once the API is enabled.
Models can link records such as orders to the current visit, and visits attach to the signed-in user when authentication allows. Bots are excluded by default, and visit and visitor tokens can be customized along with cookie and duration settings.
Data stays in your Rails database through a configurable store, with examples for streaming to Kafka, queues, or other backends as you scale. GDPR-oriented options include IP masking, anonymity sets instead of cookies, and retention helpers.
Key features
- Server-side visit tracking
- Custom event names and properties
- JavaScript and native client API
- Order and model visit association
- User-linked visit history
- Bot exclusion rules
- Pluggable analytics data stores
- GDPR masking and cookie options
Use cases
- Self-hosted product analytics in Rails
- Attributing orders to traffic sources
- Tracking funnel steps as events
- Mobile app events via Ahoy clients
- Privacy-conscious first-party metrics