Advanced Tracking in the Google Analytics Module for Drupal 6.x

Posted Date: 
Wed, 04/22/2009

In this video we will be learning about:
1. Link Tracking with Google Analytics Events
    a. Track outgoing links [to another web server]
    b. Track mailto links [to an email program]
    c. Track download links [to a file that is downloaded]

2. Internal Search Tracking

3. JavaScript Performance Tweaks
    a. JavaScript Scope
    b. JavaScript Caching

The Google Analytics module for Drupal 6.x integrates Drupal's powerful site administration tools so you can harness the fullest potential of your Google Analytics account.  The module offers user-specific, role-specific, and page-specific tracking.  It can send role or profile information to Google Analytics so you can run user segmentation reports.  You can easily extend your Google Analytics with custom JavaScript code.  The possibilities are endless!

Primary Screencast: 
Syndications

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Brilliant

Just to say thank you very much, found this video really, really helpful. It has saved me alot of hassle!

Google Analtytics is not showing the download links

Hi Brian,

When I look under events in Google Analytics, I see 'Outbound links', 'Outgoing links' and 'Mails'.

I have 3 questions for you:

First, what is the difference between 'outbound links' and 'outgoing links'?

Second, how come the download links is not showing in Google Analytics?

And last, how come I don't have the option in Drupal Module settings to put the javascript code in the header or footer of my pages?

Thanks!

Anik, Outbound and Outgoing

Anik,
Outbound and Outgoing links are the same thing. In Google Analytics 2.x they were called Outgoing, in Google Analytics 3.x they are called Outbound.

As for questions 2 and 3, I really can't diagnose the problem without seeing your system as an admin user. You may want to submit a support request to get help from the module maintainer:

http://drupal.org/project/issues/google_analytics?categories=All

Or, if you're interested, I am a drupal consultant and can help you for a modest fee.

Peace,
Brian

footer

I think the option in Drupal Module settings to put the javascript code in the header or footer has been removed.

Tracking Opened Emails

Nice article, just to add a bit: If you want to see in Google Analytics, how often an email or newsletter was opened (or viewed), you can use http://email-tracking-with-google-analytics.com/, There you can get a pixel which you insert into your email. The pixel will then cause your Google Analytics to show how often the email has been read.

track custom events

Hey mate I'm using your GA module on a new redesigned website with Drupal 6, quite powerful.

For example I'll like to track Clicks on important Call-to-Action with the implementation of your module. Is that something possible or do I manually edit my html code to add the Event on the

What is a "click"?

Brian,

Thanks for doing such an outstanding job with both the module and the tutorial. I'm using the module and it works wonderfully with Google Analytics reporting.

One question:
Do you know if the "clicks" reported in Google Analytics refers to both left clicks and right clicks combined?

For instance, if there is a link to a file hosted on an external website, and some people left click, while others may do a right click -> save file as, would they both be viewed and reported as the same click event?

Thanks!

Dan

not sure

I'm not 100% sure how the module developer is capturing click events. My gut tells me that it's just a left click. One could probably confirm this by running a controlled test and then checking GA for the results.

Difference between stat softw and Google Analytics

Hi Brian. I found your screencasts very interesting and I followed them to setup my Drupal Google Analytics module, nevertheless I've seen that there is a lot of difference between my webprovider stats and the one showed from Google Analytics. Let's say I see 100 visit x day on the first one, while only 10 in Google Analytics. I'm using the default setting for the module and I verified that the javascript code is included in any page. Is that something am I missing?

Thanks for your help.

Max

you bring up a great point

great point! my guess is that your webhost is using "Analog", "Awstats", or "Webalizer" (those are fairly standard analyics tools provided by shared hosts). if that's the case, those stats will reflect many hits that Google Analytics cannot track.
  1. Google Analytics pretty much disregards robots and non-compliant browsers because they typically don't support cookies or javascript (which are required components for GA to work).
  2. Google Analytics doesn't record hits to jpg, gif, js, css and other embeded files within your page.
  3. Google Analytics doesn't record clicks to download files like zip, pdf, etc unless you have enabled that advanced feature within the Drupal module.
  4. Google Analytics doesn't record hits for drupal admin pages and perhaps other admin activities depending on how you have configured the drupal module exclusions.
You can confirm the cause of the difference by downloading a copy of the raw log files from your host and do a little manual analysis.  I hope this points you in the right direction.  :-)
Peace,
Brian

Thanks for your clear

Thanks for your clear explanation.

Thanks for a superb video

Man, you are my hero. I've been busting my ass for two days with virtual page views to track email subscriptions. Then bingo! "/events" and I'm done.

There's almost always a simple Drupal solution. It's just never simple to find.

Thanks again. I'm a fan.

adding SWF extension

If I add a .swf file extension to the link tracking. Would that be able to track flash banner ad destinations? If so do you think it would be accurate?

probably won't work

The file extensions section in Google Analytics module will let you configure standard file downloads, not necessarily click events for swf advertisements.  If you are trying to measure click thrus for your advertisements, you'll need to add some Google Analytics ActionScript code within your swf file.  For a quick look at what I'm talking about, check out these pages:
http://blog.circlecube.com/2008/01/tutorial/integrate-google-analytics-with-flash-tutorial/
http://code.google.com/apis/analytics/docs/tracking/flashTrackingIntro.html

Will do. Thanks!

Will do. Thanks!

Hi Brian, Thanks for the

Hi Brian,

Thanks for the helpful video! I have a question. I am using Acquia Drupal and have the Google Analytics module installed. I have turned on the "track outgoing links" option in the module. However, clicks to my outgoing links don't currently show up in the Events interface of Google Analytics. When I look at the source code for my site, I don't see any JavaScript calls being added to my outgoing links (which it sounds like is needed for clicks on the outgoing links to show up as Events in Google Analytics).

Are there any additional configuration options that need to be set in order for the "track outgoing links" option to work as shown in your video?

Thanks!

try looking at the cache settings

One thing you might want to look out for are the cache settings:
yourdomain.com/admin/settings/performance
 
Try clicking the "Clear cached data" button and revisit the page(s) in question.   It's possible that the change never went into effect because Drupal was presenting a cached version of the page.

Hi Brian, i have a question;

Hi Brian, i have a question; is it correct the next code?, because when I enable the google analytics module that code is generated, but it is commented, consequently I don't know if it works

Thank you for your help

url

What is the URL of your site?

Great Content!

Hey Brian, great coverage of the content. I've been doing some Drupal tutorials also over at GotDrupal.com. I like your focused presentation and the depth of coverage. Great work! Can't wait to see more. I used the content and updated my analytics account right away.

Matt

P.S. Mollum module works much better for spam prevention. Captcha's suck when you get them wrong. Even the first time is frustrating.

thanks matt

I'll be migrating to Mollom soon  :-)

Thanks for the vids mate,

Thanks for the vids mate, you've made it really easy for me to configure this.

hi

thanks man. That makes things easier to understand.
by the way,base on http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer...

do you actually see


on the view source? it looks just normal link without onclick, but when viewing on "Events" I see the links are actually being track.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Subscribe to Drupal Screencasts (RSS)