Archive

Archive for the ‘Google Analytics’ Category

Google Analytics Full Referrer Tracking Update

February 15th, 2007 12 comments

Since I wrote about tracking the full referrer in Google Analytics, I had feedback from some people saying that their content management system, forum software, etc doesn’t allow them to modify the HEAD section or BODY tag. Some other people are also hesitant to place the code in the HEAD section incase the Google Analytics servers are slow, causing the page to pause while the tracking code is downloaded from Google. Another drawback to putting the tracking code high up on the page is that you may end up counting partial page downloads.

So to get around these issues here’s an alternative which you can place just before the end BODY tag.

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-XXXXXX-X";
urchinTracker();
urchinTracker(document.referrer);
</script>

Just replace the XXX’s with your Analytics account code.

Update: I’ve augmented the tracking code to also detect if the page is served in http or https mode to serve the appropriate call to the urchin.js file, and also detecting whether the referrer is internal or external so you don’t get your site appearing as a full referrer in the Top Content Report. View my Ultimate Google Analytics Tracking Code.

Categories: Google, Google Analytics, Tracking Tags:

Google Analytics Hack – obtaining full referring URL

January 15th, 2007 45 comments

It’s so frustrating that you can’t usually find which forum thread is linking to your website, because under the referring site report, cross segment performance, content report, it truncates the URL at the end of the filename, so you end up with items like:

/forums/showthread.php
/forums/viewtopic.php
etc.

There are two options, the first is a hack which uses filters to place the referrer into the User Defined Report (thanks to tresman and Pyrana), while the second uses a modified version of the Google Analytics tracking code to place the full referrer into the Top Content Report.

Method 1 – User Defined Report

Add this filter to your Analytics profile:

Custom Filter
Advanced
Field A -> Extract A: Referral (.*)
Field B -> Extract B:
Output To -> Constructor: User Defined $A1
Field A Required: Y
Field B Required: N
Override Output Field: Y
Case Sensitive: N

Here’s a screenshot of the filter settings:
Google Analytics Filter Settings

Results:
User defined referrer tracking

Two of the major benefits is that you don’t have to mess with the Google Analytics code and it uses the User Defined Report which goes unused in most cases.

Method 2 – Hacking the Analytics Code

I managed to find a way to use the urchinTracker function to place the exact referring URL into the Top Content Report, use one of these options (not both!):

Option 1) Place the standard tracking code in the HEAD section of the page and use this body tag:
<body onload="javascript:urchinTracker(document.referrer);">

Option 2) Place this code in the footer right before the tag:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-XXXXXX-X";
urchinTracker();
urchinTracker(document.referrer);
</script>

(Replace the XXX’s with your profile account number)

Here’s a quick screenshot of the results:
Analytics Exact Referrer Using urchinTracker hack

Once you run this report, you can then apply a filter at the top of “http” to only show the exact referrers.

The urchinTracker script is usually used for tracking javascript or Flash events :
http://www.google.com/support/analytics/bin/answer.py?answer=27229

Update: If you can’t edit the HEAD or BODY tag or want to keep the tracking code in the footer, check out the Google Analytics Full Referrer Update.

Update 2: I’ve augmented the tracking code to also detect if the page is served in http or https mode to serve the appropriate call to the urchin.js file, and also detecting whether the referrer is internal or external so you don’t get your site appearing as a full referrer in the Top Content Report. View my Ultimate Google Analytics Tracking Code.

Update: 5/10/07 – I confirmed that this hack still works with the new version of Google Analytics.

If you’re a webmaster about to do a redesign, you may want to look into some interesting free icons for your website.

Categories: Google, Google Analytics, SEO Tags: