Google Analytics Hack – obtaining full referring URL

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:


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

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:

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

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

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.

About reuben 109 Articles
SEO consultant from Columbus OH.


  1. Thanks for sharing info about this hack! I created the user defined report but can’t find it. What section of Google Analytics is it hiding in?


    Hi Sooz

    It’s under Visitors > User defined


  2. i think that you have to wait after google analytics counts some traffic using this filter… i think that this doesn’t have influence on statistics of earlier traffic

  3. Hello Reuben,

    Thank you for this great article. It appears you know how to manipulate the GA JS. I was wondering if you knew of any way that can help me add custom fields to the tracking mechanism, to be able to report on them.


  4. Hey Reuben,

    Thank you for this hack. I implemented the first method and it’s been several days since, and yet I have not seen any change in the User Defined stats in my GA page. I followed what you wrote here word for word and compared the screenshot to my setup, so I don’t understand why I don’t see the full urls. Is there any timeframe that I should wait before start looking for an alternative approach (maybe method 2.) Although, the method 1 is much cleaner, and I’d really like to stick with that.

  5. Hi Reuben,

    Thanks for this article!

    Quick question, aside from where you view the referring URLs, is there any other benefit from choosing Method 1 vs Method 2?

    Method 1 seems like the easier (and safer) choice. So I’m just wondering if Method 2 has any other advantages?


  6. Jackson: If you’re already using the user defined field for storing URL type info, then you could use method 2.

    If you’re not able to edit the analytics code, then you can use option 1.

    If you have access to the analytics code, then option 2 does give you a lot more flexibility as to which parts of your site you want to track referrers.

  7. Hi Reuben,

    Thanks for this tip. I did exactly what you said and it works. But here’s the problem. The full referring URL is still not visible when it’s very long. If you put your cursor over it, you can see it, like an alt-tag of an image, but that doesn’t help if you want to visit the referrer URL.

    I tried View Source to copy and paste the referring URL, but it doesn’t show up in the visible code.

    If you turn the data into a pdf, you can see the referring url as text, but when you go to copy it, it breaks the text at the end of each line!

    Can’t you tweak the Google Analytics filter to convert the referral url into a text hyperlink for each referrer? I think website data programs do this. It would be very helpful.

    Do you know how?

  8. Hi JT

    In the previous version of analytics you could expand the columns, but that feature is sadly lacking. I’ll see if there’s another way to do it and write up a post in a few days.

  9. Reuben – thanks so much for the detailed report & instructions. I’ve been wanting to add this forever, and never got around to Googling for it. Your post was the #1 result.

    Two other things:
    1) JT – if you export the results (PDF, CSV, etc.), the full URLs are there. Not as good as expanding the columns, but better than hovering over each one.

    2) Reuben – I’m curious to learn about *how* this works (like, for example, what does (.*) mean, and how did you know to put $A1 in the Construction field. Is there a tutorial on filters than you can recommend?

    Thanks again,
    Brian Greenberg

  10. Thanks for the post.

    I implemented Method 1 and noticed that some of the URL directories appearing in the User Defined report was not appearing in the Referring Sites report. Has anyone else noticed that? and is there a particular reason why this would be happening?

    Also, for those directories that do appear on both sites, the statistics are different (i.e. Pages/Visit Time on Site, etc.).

    FYI: I do know that Referring Sites report does store the different query parameters in the string, and that to dive down into a directory, you must first click on the domain.

  11. Hallo, It’s a very interesting post. But in option 1 and 2 there is no code to copy ;) Where can I find It.

  12. Sorry about the missing code, it was there in the source, but when I upgraded to a new version of wp, the specific plugin that displays code wasn’t installed.

  13. Where do I see the results of the first method? I tried “Traffic Sources” -> “Referring Sites” and then changing the Source to “User defined value” but nothing showed up. The filter has been running for 2 days.


  14. Great article! Thank you I vote with two hands.
    I do not understand why google misses that info by default. Sometimes when a forum is referring traffic from different threads you can not track that. It was really annoying.

    Thank you so much for sharing this info!

  15. Great tip! I’ve been looking for something like this forever. I still don’t understand why Google doesn’t implement this by default… Thank you

  16. Hi Reuben,

    I implemented method #1 yesterday but I can’t find the user defined report anywhere in my account. I feel like a total noob about that! I looked everywhere online and can’t find any info.

    Would you mind helping me?

    Thanks in advance

    Sebastien // @sebastienpage

  17. Sebastien: Once you’ve selected an account and are viewing the reports, click on the visitors link in the left nav, then you should see User Defined as the last one in that list.

  18. Duh! That’s strange because I could swear I looked over there several times. Anyways, it’s here now. Thank you very much for this great trick and for your help.
    Sebastien Page

  19. Hi there,

    I’ve used your method 1 (for two domains) and when I click user defined under visitors the value shown in the right pane is:
    1.(not set)
    2.usergroup-1-Unregistered / Not Logged In

    Have I done something wrong?


  20. No, you didn’t do anything wrong. The filter only works on visits after you created it. So in the future, you’ll see the desired results.

    This seems like basic functionality. Why doesn’t GA have this out of the box?

  21. Hello, just setup the first method around 24h ago. The report is still the same. How much time should it take before it appears ?
    I really need that cause i use the same code on multiple domains.

  22. We have been using this trick for about 6 months and all of the sudden (April 18, 2010) we are not seeing the referring sites anymore. Everything shows up as “not set”.

    We made no changes to our set up (both in GA and our website).

    Any thoughts? Anybody experiencing the same thing?

  23. Hi Dennis, I’m experiencing the same problem from April 18th. No referral data anymore. I was using “Method 1 – User Defined Report”.
    Do you have any solution?

39 Trackbacks / Pingbacks

  1. Inside SEO with Mr SEO » Google Analytics Hack - How to obtain full referring URL
  2. XT-Commerce Blog » Volle Referrer bei Google Analytics
  3. How to Obtain the Full Referring URL in Google Analytics - things of sorts
  4. Obtain the Full Referring URL in Google Analytics » 10e20 - Search, Design & Social
  5. Marc Charbonneau’s Blog » Display dynamic referrer URLs in Google Analytics
  6. Ituloy AngSulong » Getting the Full Referring URL - Google Analytics Hack
  7. How to Obtain the Full Reffering URL in Google Analytics ::
  8. » Link Shuffle #11
  9. » A Cool Google Analytics Hack - Displaying Dynamic URL Refferer » Kichus - SEO KiD
  10. Google Analytics Hack » Solo Technology
  11. Google Analytics Hack - obtaining full referring URL - vBulletin SEO Forums
  12. Apogee Search Marketing Blog | SEO | PPC | Google | Yahoo » Blog Archive » URL Detail in Google Analytics | Austin, Texas
  13. Simple Hack To Obtain Exact Referring URLs On Google Analytics -
  14. Simple Hack To Obtain Exact Referring URLs On Google Analytics - Affiliate Marketing Blogger
  15. Hack to force Google Anyalytics to give up the full referring url « geek-o-pedia
  16. Google Analytics - User Defined visitor tracking - SEO Toronto
  17. ?? ? ?? ???? ??? ????
  18. T=Machine » Web Analysis Tools: what’s free?
  19. 30+ Google Analytics Tools, Goals, Segments, Filters, Hacks & Resources | SEOptimise
  20. Web Analytic Suite for Search Marketers » PageTraffic SEO Blog
  21. Google Analytics Filter - Display Full URL
  22. Google Analytics Plugins, Hacks and Tips Collection | FutureNow's GrokDotCom / Marketing Optimization Blog
  23. The Best, Simplest Google Analytics Hack You’re Probably Not Using | therouxDown
  24. Google Analytics Trick: See The Full Referring URL
  25. 7 Advanced Google Analytics Tricks
  26. Google Analytics Mega-Post: 23 Google Analytics Tips and Tweaks | Search Engine People | Toronto
  27. Cel odkazujca URL v reportoch Google Analytics
  28. 30+ Google Analytics Plugins, Hacks & Tricks
  29. DISCUSSION: Measuring the value of social media – what are the metrics? |
  30. 30 astuces Google Analytics, Hack et plugin | Blog Marketing
  31. SEOMOZ by Fernando Macia
  32. Bookmarks for October 25th through October 30th | David.R.Gilson
  33. Socialism, Comrade « Only When the Words Outdo the Silence
  34. 75 Ultimate Google Analytics — Tools, Tips & Tricks Resource
  35. GA Checklist: Spicy Implementations | PadiCode
  36. The Huge Collection of Google Analytics Tips « Tôi thấy, tôi nghĩ và tôi ghi lại
  37. The vast collection of Google Analytics Tips |
  38. 35+ tips and tricks for sexier Google analytics reports.
  39. Track Google Plus Referrals in Google Analytics! » SEO News PageTraffic Buzz

Comments are closed.