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.
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:

Results:

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