8

I would like to monitor users' page visits and clicks in my Rails app to make recommendations. My questions are:

  • Is there a Rails gem for this, or Google Analytics is the standard? If latter is true, then how should I link a page visit to a particular user profile?
  • It is typical in Rails to have a section in application.html.erb, which is shared for all pages. If I add Google Analytics pageview tracking code to in application.html.erb, will it be able to track all individual pages?
4

3 に答える 3

9

私は偏っていますが、リアルタイムでページ ビューをアプリに統合する必要がある場合は、impressionistをチェックすることをお勧めします。分析では、常にある程度のタイムラグが発生し、外部の依存関係にも依存しています。この種の制御が必要な場合は Impressionist が適していますが、単純なメトリックを探しているだけでアプリに取り込む必要がない場合は、おそらく分析が適しています。

于 2012-04-17T05:00:41.407 に答える
9

There are other ways, but the vast majority probably use Google Analytics. Several gems exist that help you integrate with GA to get at the data. See here: https://www.ruby-toolbox.com/categories/Web_Analytics.

Based on your first question, it seems you may want more insight than GA can provide. I've used ClickTale (http://www.clicktale.com) and Woopra (http://www.woopra.com) before, to good effect. This article lists several other alternatives, too - notice the high marks for Clicky: http://imimpact.com/web-stats-alternatives-to-google-analytics/.

Google Analytics (and almost all of these others) will take care of your second question automatically whenever the user loads a new page, since it keyed by URL. That means that, although you put the GA script code in a single place, each unique page is tracked individually.

If you have AJAX requests that change that page without changing the URL, you'll need to dig in to the GA script API. Essentially you'll need to push a new url (possibly with a # in it) whenever you want to track an AJAX-driven link/button click. See here: http://davidwalsh.name/ajax-analytics

于 2012-04-17T03:12:22.950 に答える
6

https://github.com/ankane/ahoyで Ahoy をチェックしてください。アプリに数行のコードを追加するだけで、ページ ビューを追跡し、それらをユーザー アカウントに関連付けることができます。

Ahoy をさらにカスタマイズして、クライアント (JavaScript を使用) とサーバーの両方でカスタム イベントを追跡できます。

Ahoy はサードパーティのサービスに依存していません。

于 2014-09-16T13:51:32.823 に答える