Google Analytics for Drupal

Google Analytics is a free website traffic analyzer. You feed it data by embedding a small bit of Javascript into all of your website pages; information about each hit is fed back to Google, where it is packaged up into a dizzying array of statistics and reports. I set it up to get a baseline reading on my websites, and so far have only been using it to track my overall traffic. I haven't dug into it any farther than that, partly because I don't have enough traffic to justify it, partly out of fear of information overload.

It has a concept of "goals" which looks interesting: mark a page as a "goal" and Google will track how many of your users make it there, and what paths they take. For my projects, the goals would probably be the download page, and maybe a donation page. Again, I haven't dug too far into this yet.

Later on I might also take a look at CrazyEgg (silly name, that). This service does Google one better: it actually tracks the exact location of user clicks, and displays the information as a color-coded "clickmaps". This service isn't free, but once I've got a real project ramped up I might check it out. For now, free is good.

Setting It Up

Setting up Google Analytics under Drupal is a breeze. Start by downloading and installing the Drupal Google Analytics module. No need to configure it yet, just install and activate it. Then, log into Google Analytics and register your site by creating a "website profile".

Add New Website link

Google will hand back a snippet of Javascript code that needs to be embedded into your webpages. All we care about is the "User Account ID", which I've highlighted in the sample below.

<script type="text/javascript">
_uacct = "UA-1234567-8";
urchinTracker();
</script>

Copy out the ID, then visit the settings page for the Google Analytics module and paste it into the User ID field.

Analytics Module User ID field
Paste ID here.

That's It!

You are set up with Google Analytics. Traffic statistics are updated once per day, so you should start to see the results trickle in sometime in the next 24 hours. In the meantime be sure to explore the Analytics
website, they do provide a lot of information on how to make the most of the service.

I will update this article from time to time as I discover new information or better solutions; check for updates on my blog.

Filed under: Drupal, google

I am Jason Perkins (starkos), the founder of Industrious One. I'm yammering on about life as an indie, getting things done, Saabs, roadtrips, finding inspiration, and creating the big audacious stuff.

projects:

categories: