Ahoy Captain - Josh Brody Ahoy Captain | Josh Brody
All projects
Ruby Gem

Ahoy Captain

Mountable analytics dashboard for Rails, powered by Ahoy.

Ahoy Captain is a drop-in analytics dashboard for Rails apps that already use Ahoy for tracking. Mount it, configure your event names, and you get a Plausible-style dashboard without sending data to a third party.

Why it exists

Ahoy handles event tracking well, but visualizing that data usually means building your own dashboards or exporting to external tools. Most teams end up with a handful of ad-hoc queries or pay for analytics SaaS that duplicates data they already have.

Ahoy Captain sits on top of your existing Ahoy data. No new tracking code, no external services, no data leaving your infrastructure.

What you get

The dashboard covers the usual analytics needs:

  • Traffic sources: referrers, UTM parameters, direct vs organic;
  • Page analytics: top pages, landing pages, exit pages;
  • Geography: country, region, city breakdowns;
  • Devices: browser, OS, device type;
  • Goals: track conversions and build funnels;
  • Filtering: slice by any dimension, combine filters, compare date ranges;
  • Export: CSV for everything.

How it works

Ahoy Captain reads from your existing ahoy_events table. It expects events with a $view name and controller/action properties for page tracking, but you can configure the event structure to match your setup.

# config/initializers/ahoy_captain.rb
AhoyCaptain.configure do |config|
  config.event_name = "$view"
  config.tracked_url_param = :url
end

Mount the engine and you’re done:

# config/routes.rb
mount AhoyCaptain::Engine => "/analytics"

Requirements

PostgreSQL with a JSONB column for event properties. The gem uses Postgres-specific queries for performance. MySQL support isn’t there yet.

For large datasets, run the included migration generator to add indexes:

rails g ahoy_captain:migration

Origin story

Built during the Rails Hackathon in July 2023. The goal was a self-hosted Plausible alternative that worked with existing Ahoy installations. It does that.

Stack

Ruby Rails PostgreSQL

Stay in the loop

Occasional essays on design, tools, and the craft of building things. No spam, unsubscribe anytime.

Ambient weather

The background of this site reflects the current weather and time of day in Saint Paul. The orbs shift in color and behavior based on what's happening outside my window.

Learn more about how this works