Integrations Ruby on Rails

Cookie-Free Analytics for Ruby on Rails

Rails applications can add GhostlyX to the application layout in one step. Track your marketing pages and application views with accurate, cookie-free analytics.

Get started free Free plan available · Setup in 3 minutes

Installation guide

1

Add the script to application.html.erb

Open app/views/layouts/application.html.erb and add the GhostlyX script inside the <head> tag.

Code
<!-- app/views/layouts/application.html.erb -->
<head>
    <title><%= content_for?(:title) ? yield(:title) : 'My App' %></title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <script defer src="https://cdn.ghostlyx.com/gx.js" data-site-id="YOUR_SITE_ID"><\/script>
    <%= stylesheet_link_tag "application" %>
</head>
2

Turbo Drive compatibility

GhostlyX automatically detects Turbo Drive page transitions (used by default in Rails 7 and above) and tracks them as individual pageviews. No extra configuration is needed.

Why Ruby on Rails users choose GhostlyX

Rails applications using Hotwire and Turbo benefit from analytics that understands SPA-style navigation. GhostlyX handles Turbo Drive transitions automatically. Because Rails is often chosen by teams who value the "convention over configuration" philosophy, GhostlyX's zero-configuration privacy compliance is a natural fit.

Cookie-free tracking

No consent banner required under GDPR or PECR

Under 1.5 kB script

Negligible impact on page speed and Core Web Vitals

Real-time dashboard

See visitors as they arrive, updated every few seconds

Free plan available

Start tracking without a credit card

Replacing Google Analytics on Ruby on Rails?

See how GhostlyX compares feature by feature, including script size, GDPR compliance, and pricing.

GhostlyX vs Google Analytics

Ready to add GhostlyX to Ruby on Rails?

Free plan available. Setup takes 3 minutes. No cookie consent banner required.

Get started free