Note

I am no longer using Google Analytics on this blog. (2015-08-18T07:43:15Z)

If you like to know who links to your contents via visitors, you may have problem when someone posts a link of your content in forums posts or on some webapp which uses some sort of ID in query string. Because, by default, Google Analytics will drop the query string part except those are from search engines, but only the keywords are kept. Query string is not stored, at least not visible to us, unless you tell Google Analytics to keep them. Well, keep indirectly.

1   The filters

There is an old post from 2009 and its useful and valid for today, Google Analytics Trick: See The Full Referring URL. I use it to create a report for those links.

Since it will process the data, User Defined will be written, which I dont like to. Therefore, I created a new profile under same Property ID (UA-XXXXXXXX-X). This way, I wouldnt touch the raw data in default profile. Here is a complete list of what I did:

  1. Create a new profile - Click on Admin button from the default profile, there is a +New Profile button.
  2. Create these filters:
Name Type Field Pattern
Has Query String Custom Referral \?
Include
No Google (outdated, see next update) Custom Referral www\.google(\.[a-z]+)+/(imgres|search|url)\?
Exclude
Full Referer URL Custom Field A (.*)
Referral
Advanced Output To Constructor $A1
User Defined

Has Query String filter checks if referrer URL has ? in. If so, then it is a referral pageview and possibly an organic pageview, with query string. If you want to keep all referrals, then you can replace this filter with the following filter:

Name Type Field Pattern
Referrals Only Custom Referral .
Include

This filter will only exclude pageviews which Referrals value is (not set), those are direct links. Only Referrals and Search pageviews remain after this filter.

The second filter No Google is to exclude Google Search referrals, you probably dont want to see them other than view from Traffic Sources / Sources / Search report. I didnt see filter field for Medium, if there was one, it will be easier than having a pattern like the one in this filter, which only works for Googles URLs.

You can view the report at Audience / Demographics / User Defined. I created a custom report for easy access and having information I need:

Google Analytics_1331118658745

While I was creating this, I realized that you can just have the third filter, then do the rest of filtering in custom report. However, i really dont need those extra pageviews, I wouldnt need to do so, because I can always go back to my default profile for those pageviews.

I am still tuning this profile and filters, I dont need to see pageviews from websites which do not really have contents, such as bookmarking services. I want to read what people say about my posts not just a link sitting in a sea of bookmarks.

2   (not set) issue

My Referrals Only filter was not working. I thought it could filter out by matching (not set), but that is not the real value. To exclude it, use Include Type:

Name Type Field Pattern
Referrals Only Custom Referral .
Include

I think Exclude Type with pattern ^$ might also work. Note that you need to give it at least 24 hours to be sure the data is fully operational on new filters. I made such mistake when Has Query String was still effective. Google Analytics should provide some testing function. It is really pain-in-the-ass, when you cant 100% which filters were used in the report, you have to wait long enough, at least one day. You must entirely sure the report with the calendar dates range has no old filters in effect, you would be misled to think your new filter is working.

I recently also had some kind filter error, but it was not reported, only the report had no data. I suspect if your pattern had grown too complicated, it would fail and you got no indications until you finally realized that is unusual for report had no data in it.

3   Updated on 2012-03-14

During the last week after posting, I made a few changes and added a few filters to exclude more unwanted referral URLs.

Name Type Field Pattern
No Google (outdated, see next update) Custom Referral (www|translate)\.google(\.[a-z]+)+/ (cse|imgres|m|reader/igoogle-module|search| translate_p)\?
Exclude
No Search (outdated, see next update) Custom Referral ^https?://[^/]*search|[^/]+/
Exclude
No Blogger Custom Referral blogID=3803541356848955053
Exclude
No Redirection (outdated, see next update) Custom Referral (www\.google\.[^/]+/url| www\.facebook\.com/l.php| link\.smartscreen\.live\.com/\?l=)
Exclude
  • No Google: Translate translate_p, Custom Search cse, Mobile m, and iGoogle with Reader.
  • No Search: this should be able to exclude generic search engine with search word in domain name.
  • No Blogger: this prevents the visits from me when I click internal links in the new post I am writing.
  • No Redirection: this types doesnt provide where the link is used, so just exclude them.

4   Updated on 2012-07-09

Here is my latest filters, I broke No Search into two new filters, No Search Word and No Other Search.

Name Type Field Pattern
No Search Word Custom Referral ([^/]*search[^/]+/|[^/]+/[a-z]*search)
Exclude
No Other Search Custom Referral ask\.com/web|duckduckgo\.com
Exclude
No Google Custom Referral google(usercontent)?(\.[a-z]+)+/(custom|cse|imgres|m|reader/|igoogle-module|search|translate_[cp])
Exclude
No Redirection Custom Referral (([^./]+\.)+google(\.[^./]+)+/url|www\.facebook\.com/l.php|link\.smartscreen\.live\.com/\?l=)
Exclude

Edited on 2012-07-12 fix unwanted spaces because of copy-and-pasting.

5   Final update at 2014/08/14 09:13:18

  1. Has Query String

    • Custom / Include
    • Referral: \?
  2. No Search Word

    • Custom / Exclude
    • Referral: ([^/]*search[^/]+/|[^/]+/[a-z]*search)
  3. No Other Search

    • Custom / Exclude
    • Referral: (ask|baidu|duckduckgo)\.com
  4. No Google

    • Custom / Exclude
    • Referral: google(usercontent)?(\.[a-z]+)+/(custom|cse|imgres|m|reader/igoogle-module|search|translate_[cp])
  5. No Redirection

    • Custom / Exclude
    • Referral: ([^./]+(\.[^./]+)+/(click/jsredir|link|url)\?|www\.facebook\.com/l\.php|link\.smartscreen\.live\.com/\?l=)
  6. No Blogger

    • Custom / Exclude
    • Referral: 3803541356848955053
  7. No Disqus

    • Custom / Exclude
    • Referral: disqus\.com/embed/comments/\?

    Disqus 2012s embed will request the same page as it loads, which I found very strange. The referrer URL looks like

    http://disqus.com/embed/comments/?f=[SHORTNAME]&t_u=[URL]&t_t=[TITLE]&s_o=popular

    Where [URL] and [TITLE] are the pages URL and title, where Disqus is loaded upon. [SHORTNAME] is the Disqus ID. The only valuable referrer should be the shortname isnt yoursif you dont care about intra-referrer, then you exclude referrers with your shortname, leave referrers only are from others Disqus discussions.

  8. Full Referrer URL

    • Custom / Advanced
    • Field A / Referral: (.*)
    • Output to Constructor / User Defined: $A1