简体   繁体   中英

Building an analytics dashboard in Rails

I'm looking to build a Rails app to do internal reporting (make charts or general data visualizations, create reports, show statistical analyses, etc.) on data my company collects.

What would be helpful in building this? For example, any Rails/Javascript libraries I should be familiar with, or any open source analytics apps or existing dashboard tools I should look at?

Google Visualization API is an easy way to get charts in your application. You could also have a look at Protovis and possibly InfoVis Toolkit .

I'm actually doing almost the exact same thing right now, so I know what you are going through. For ruby on rails, there's a gem out there called Garb. So far it has worked pretty well for me. Example:

results = []
Garb::Session.login(analytics_email_address, analytics_password)
web_properties = Garb::Profile.all #you can filter here with a clojure or something
for profile in web_properties
  report = Garb::Report.new(profile, start_date, end_date)
  report.metrics MY_METRICS #you can read about these on the analytics api docs
  report.dimensions MY_DIMENSIONS #same here
  results << report.results
end
#do more stuff

This is a simple/quick/dirty example, but it works; you can get the information you need about the metrics and dimensions here:

http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html

and Garb information here:

http://www.viget.com/extend/introducing-garb-access-the-google-analytics-data-export-api-with-ruby/

I know that reporting is really frustrating, so I wish you the best of luck!

Don 't forget to create summaries of your data if you have lots of data. For example calculate all pageviews for a single day and store them in a Day table or so. Otherwise your app will become very unresponsive. Dont forget that Ruby 1.8 sucks for stats and math (slow)

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