简体   繁体   中英

How to do site analytics with ruby on rails

I was wondering what are the options for doing site analytics with a ruby on rails application ? I haven't seen any solutions specifically targeted towards rails - more towards apache type web servers. I don't want to use the google analytics, I'd like to have the logging/analyis all local. After a quick look at wiki's list of web analytics software http://en.wikipedia.org/wiki/List_of_web_analytics_software , I can't see anything that I can see how to incorporate into my rails/ruby app.

AFAIK Rails deployments behind both Apache and nginx can both benefit from the host of tools developed for parsing web logs over the years. I loved AWStats :)

For application events not explicitly in the web logs - like logins, sign-ups, purchases - I'd recommend using keen-gem from Keen IO (Disclaimer - I work there). It's pretty easy - install or bundle the gem, then just add lines like this:

Keen.publish_async("sign_ups", { :username => "lloyd", :referred_by => "harry" })

anywhere in your Rails app to log events. Once the events have been logged you can use the workbench at keen.io to run queries and see visualizations, or you can use the REST API to pull any and all data back out for custom processing.

Most people deploy rails applications behind Apache or other web servers, because Rails applications can be set up to allow those web servers to quickly and efficiently serve static assets and cached pages. This also means that we can use the same log analysis tools we've always used like Analog, AWStats, etc.

Or we can just punt and use google analytics. I like row logs though :)

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM