Drupal Google Analytics Setup

I just set up Google Analytics on Drupal for kristen.org and some other sites I'm working on. I have used awstats in the past but not Google Analytics but everyone was raving about it, so now I can see what's the buzz.

First, I signed up with Google Analytics which is (of course) free. Also, you can set up several websites in your account as well as share accounts and create multiple accounts. Very handy.

I did make a mistake setting it up initially because someone had added me to their GA account already so I just added my websites when I was viewing that account. That meant that they could view the website statistics for the sites I added... oops! Fortunately, I realized the mistake pretty fast and didn't really have any data yet.

So, to create my own account, I chose "Create New Account" in the upper right drop-down list and filled in the info for kristen.org. It gave me the javascript needed for the tracking, but I just grabbed the code out of it (UA-xxxxxxx-x).

I used the Drupal Google Analytics module by downloading the zip file and unzipping it and ftp'ing the files to GoDaddy in the correct location.

1) ftp -u xxx yyy.zzz
2) cd sites/all
3) mkdir modules (if not there already)
4) mkdir google_analytics
5) put *inc *info *install *js *module

After copying the code into place, I logged in as admin on my website and went to the Drupal modules page (/admin/build/modules) and turned on the Google Analytics module. Then, I went to the Drupal Google Analytics settings/configuration page (admin/settings/googleanalytics) and entered in my code into the "account number" field.

To make sure it was really working, I simply did a "view source" on a page that should be tracked (e.g. home page but not admin pages) and looked for the javascript (contains ga.js in it). Once I saw the javascript was there, I went back to my Google Analytics account page and clicked "Check Status" for the desired website. I could tell it was added correctly because it said "Tracking Installed" (or "Waiting for Data" if on the "Edit" page). It took a few hours before any data appeared.

Update - 1/2/09 - When configuring the Drupal Google Analytics module, it's a good idea to include the user role in the tracking code or limit the roles tracked to Anonymous (unless you plan on having lots of registered users). Otherwise, your statistics will include admin views. You can also get better Drupal node count statistics by using the Advanced Statistics Settings module.

Am I doing something wrong?

Kristen,
I did everything up to this point...
"After copying the code into place, I logged in as admin on my website and went to the Drupal modules page (/admin/build/modules) and turned on the Google Analytics module. Then, I went to the Drupal Google Analytics settings/configuration page and entered in my code into the "account number" field."

But when I enabled the module, I don't get the config page. :(
I'm operating Drupal 6x, is it on a core page as an option.
helplessly lost on this...your help is much appreciated.

Thanks
Stefan

Google Analytics Settings Page

Hi Stefan,

Hopefully you already figured it out but, if not, the settings page is at admin/settings/googleanalytics. I'll update the article to be more clear. If you haven't already installed it, I recommend the Administration Menu module so that you have a quick menu on the top of the page for finding your settings pages; otherwise, these can be harder to find.

Good luck,
Kristen

New User Installed Google Analytics

Thanks for the great blog article. I am a new Drupal user & found this most helpful. Installed this in a matter of minutes & confirmed it is working. I will be back to visit again for more tips.

-Les-