Rails and Google Analytics

Has anyone successfully configured Google Analytics to work with a Rails application? I have tried included the Javascript in one of my layouts and Google Analytics still says:

" Tracking Unknown (Last checked: 2006-09-12 7:16 PM PST.) The Google Analytics tracking code has not been detected on your website's home page. For Analytics to function, you or your web administrator must add the code to each page of your website."

I was able to set it up successfully with some static HTML pages, so I'm assuming it's Rails?

Thanks Tony

Included in the second should be including, sorry for the typo.


Not a Rails bug. Google Analytics works fine with anything that includes its javascript in the of the HTML. Make sure you have the right value in your _uacct field and that when you load the page from a browser it shows up.

Is your site publicly accessible? I think google first needs to 'ping' your site to 'activate' it.

Actually Google recommends including their javascript at the very end of the page:

from http://www.google.com/support/analytics/bin/answer.py?answer=26908&topic=7325:

"Copy and paste the code segment into the bottom of your content, immediately before the </body> tag of each page you are planning to track. If you use a common include or template, you can enter it there."

We're using analytics with our Rails app, it rocks.


Steve Longdo wrote:

Sorry for forgetting to respond to my own topic. Just thought I would say that I fixed the Google Analytics problem, their was a simple syntax error in my Google Analytics code. Should have looked harder


Thanks, Tony