Now, when you build a Rails starter application with Rails Composer, you get the option of page-view tracking without any effort. Run Rails Composer and you’ll see:
recipe Running analytics recipe... option Install page-view analytics? 1) None 2) Google Analytics 3) Segment.io choose Enter your selection: 2 option Google Analytics ID?
I like Segment.io because it gives me Google Analytics plus any of 107 other services. With Segment.io, you can instantly switch on tracking for services such as Mixpanel, KISSmetrics, and many others. It’s a commercial service but it’s free for low-traffic sites (less than 100K pageviews or events per month). Rails Composer installs the Segment.io tracking script in the Rails asset pipeline, and adds code to accommodate Rails TurboLinks.
Rails and Analytics
I wrote an article on Analytics for Rails last year. You can see the article for more about the code you need for analytics. My goal for Rails Composer is “no mystery code.” That’s why I write tutorials and articles to explain the code generated by Rails Composer. Thanks to support from RailsApps subscribers, I was able to update the article this week. Please join me in giving a shout-out of thanks to the subscribers who pay $19/month to make this possible. And if you haven’t joined, please consider getting a subscription to support the project.
There’s also a new mailing list for news about Rails Composer. Join the mailing list if you want announcements of new features for Rails Composer.