I got it done by using Segment.io, which I've been using for about a year as the primary "Adapter Pattern" for all analytics on my Ruby on Rails apps, Middleman apps, Rack apps, and other static sites. I have Google Analytics and Intercom set up through it and all kinds of other email, customer retention, and analytics tools.
In sum, those tools help me understand whether the things I've built are things that any users or customers actually want, helps me drive traffic to them, and help me grow the products.
Sometimes it's better to interact with Segment.io from the server-side, though. In Segment.io and Ruby
, Josh talks about how to do it cleanly and in a testable way from inside a Rails app, with RSpec matchers.