简体   繁体   English

如何在rails上使用ruby进行站点分析

[英]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 ? 我想知道使用ruby on rails应用程序进行站点分析有哪些选择? I haven't seen any solutions specifically targeted towards rails - more towards apache type web servers. 我还没有看到任何专门针对rails的解决方案 - 更多的是针对apache类型的Web服务器。 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. 在快速浏览了wiki的网络分析软件列表http://en.wikipedia.org/wiki/List_of_web_analytics_software之后 ,我看不到任何可以看到如何合并到我的rails / ruby​​应用程序中的内容。

AFAIK Rails deployments behind both Apache and nginx can both benefit from the host of tools developed for parsing web logs over the years. Apache和nginx背后的AFAIK Rails部署都可以从多年来为解析Web日志而开发的大量工具中受益。 I loved AWStats :) 我很喜欢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). 对于未在Web日志中明确显示的应用程序事件 - 例如登录,注册,购买 - 我建议使用来自Keen IO的keen-gem (免责声明 - 我在那里工作)。 It's pretty easy - install or bundle the gem, then just add lines like this: 这很简单 - 安装或捆绑gem,然后只需添加如下行:

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

anywhere in your Rails app to log events. 在您的Rails应用程序中的任何位置记录事件。 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. 记录事件后,您可以使用keen.io上的工作台运行查询并查看可视化,或者您可以使用REST API将任何和所有数据撤回以进行自定义处理。

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. 大多数人在Apache或其他Web服务器之后部署rails应用程序,因为可以设置Rails应用程序以允许这些Web服务器快速有效地提供静态资产和缓存页面。 This also means that we can use the same log analysis tools we've always used like Analog, AWStats, etc. 这也意味着我们可以使用我们一直使用的相同日志分析工具,如Analog,AWStats等。

Or we can just punt and use google analytics. 或者我们可以直接使用谷歌分析。 I like row logs though :) 我喜欢行日志:)

Hope that helps! 希望有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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