Rails+Google Analytics=easy goal trocing
1500 ワード
もっと読む
Google Analytics is indispensable tool as You optimize the busines side of your operation.If You haven't already set up goals in Analytics for view your prinformation,acceing the sign-up forning,Conc.It's vital information.
However,Google Analytics'goals have to be atached to a specific URL.What if there isのURL for an importgoal?For example、the New Acceount goal for Scuout is just/show page--there'sのspecific URL to represent a newly created account.
flash[:analtics]to the recue
For this situation、we found a nice clean solution with Rails'flash helper+a touch of Javascript.
Rails'flash helper is exactly the same one you use to display errors and notices.But you can pass anything in a flash.In our
flash[:analtics][email protected]?「/goals/free」:「/goals/paid」
The n、in our layout、
pageTracker._trockPageview(");
It's as simple as that!We can register arbitrary goals in any action by setting
Key TaeawaysGoogle Analytics is esential you can register arbitrry URL's via Google Analytics' Rails'flash helpers make it eay and clean to register anlytics for any action in your ap
Google Analytics is indispensable tool as You optimize the busines side of your operation.If You haven't already set up goals in Analytics for view your prinformation,acceing the sign-up forning,Conc.It's vital information.
However,Google Analytics'goals have to be atached to a specific URL.What if there isのURL for an importgoal?For example、the New Acceount goal for Scuout is just/show page--there'sのspecific URL to represent a newly created account.
flash[:analtics]to the recue
For this situation、we found a nice clean solution with Rails'flash helper+a touch of Javascript.
Rails'flash helper is exactly the same one you use to display errors and notices.But you can pass anything in a flash.In our
Accounts_controller#create
action、wecal:flash[:analtics][email protected]?「/goals/free」:「/goals/paid」
The n、in our layout、
application.html.erb
、within the same
include Google Analytics:pageTracker._trockPageview(");
It's as simple as that!We can register arbitrary goals in any action by setting
flash[:analytics]
・・Within Google Analytics、just set the goals with the same names you've given the flash:Key Taeaways
_trackPageview()
cal