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.
Contents
1 The filters
There is an old post from 2009 and it’s 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 don’t like to. Therefore, I created a new profile under same Property ID (UA-XXXXXXXX-X). This way, I wouldn’t touch the raw data in default profile. Here is a complete list of what I did:
- Create a new profile - Click on Admin button from the default profile, there is a “+New Profile” button.
- 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 Referral’s 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 don’t want to see them other than view from Traffic Sources / Sources / Search report. I didn’t 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 Google’s URLs.
You can view the report at Audience / Demographics / User Defined. I created a custom report for easy access and having information I need:
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 don’t need those extra pageviews, I wouldn’t 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 don’t 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 can’t 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 doesn’t 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
Has Query String
- Custom / Include
- Referral: \?
No Search Word
- Custom / Exclude
- Referral: ([^/]*search[^/]+/|[^/]+/[a-z]*search)
No Other Search
- Custom / Exclude
- Referral: (ask|baidu|duckduckgo)\.com
No Google
- Custom / Exclude
- Referral: google(usercontent)?(\.[a-z]+)+/(custom|cse|imgres|m|reader/igoogle-module|search|translate_[cp])
No Redirection
- Custom / Exclude
- Referral: ([^./]+(\.[^./]+)+/(click/jsredir|link|url)\?|www\.facebook\.com/l\.php|link\.smartscreen\.live\.com/\?l=)
No Blogger
- Custom / Exclude
- Referral: 3803541356848955053
No Disqus
- Custom / Exclude
- Referral: disqus\.com/embed/comments/\?
Disqus 2012’s 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 page’s URL and title, where Disqus is loaded upon. [SHORTNAME] is the Disqus ID. The only valuable referrer should be the shortname isn’t yours—if you don’t care about intra-referrer, then you exclude referrers with your shortname, leave referrers only are from other’s Disqus discussions.
Full Referrer URL
- Custom / Advanced
- Field A / Referral: (.*)
- Output to Constructor / User Defined: $A1
Very nice! Thank you so far!!!!
ReplyDeleteThis is what I was looking for.
I followed your explanations, but got only (not set) for every link of report?
Wonder where it comes from?
You need either "Has Query String" or "Referrals Only" filter as mentioned above.
ReplyDeleteWill it include plus.google.com?
ReplyDeleteMay or may not. The filters above do not take Google+ URL into account, it depends on how the link looks and what filter you use.
ReplyDeleteThx
ReplyDeleteMay I ask if I filter out some traffic like no google, no search, no redirection.
It will just drop the record or google analytic will keep it but not show in the custom report?
No. The data being filtered will not be kept in the profile, that's why my first step is to "Create a new profile."
ReplyDeleteCreate a new profile under same property-ID (UA-number), so you can still have original data in original profile. Read third paragraph, it's explained.
Thx so much
ReplyDeleteI am still testing those value, but I think (not set) with include . is not working to me.
My default report without this value can show all referral, but the one with this value doesn't record any traffic.
Now I am trying Exclude Type with ^$, I hope it will work.
How long did you wait for? It's better you create a new profile when you are testing filters, you have no way to tell when newly added filter has been effective or removed filter has not.
ReplyDeleteWhen you add or remove one from a set of filter, it will be very confusing, because you can't tell. Adding or removal of filter won't be effective right away, usually hours after.
ic, thx so mush
ReplyDeleteI just tested about 6hr. May be I should wait some time first.
Hi livibetter,
ReplyDeleteI think I found out the problem, it's the "no search" filter remove all traffic.
Here are some screen cap of User-Defined result:
https://lh4.googleusercontent.com/-nFbIL9A1cC8/T_owHiBftHI/AAAAAAAAADI/y4-DGJWGhcI/s1030/have+google.JPG
This one have "no search" and "no redirection", as you see all traffic filtered out.
https://lh3.googleusercontent.com/-LbrM0o9t8zA/T_owHhjTvHI/AAAAAAAAADM/CGjJskZpn_8/s1055/have+redirection.JPG
This one have "no search" and "no google", it's still no traffic
https://lh4.googleusercontent.com/-FYKyMkGURTQ/T_owHslx5TI/AAAAAAAAADQ/qAwyBf8Qma0/s943/have+search.JPG
This one have "no google" and "no redirection", it can record the referral traffic, like from forum "uwants" and "discuss.com.hk", but it also record the traffic from google, so I think "no google" and "no search" are not working.
I believe you are right, IIRC I did mess up the filter but I didn't update the post after I fixed, please see the new update section.
ReplyDeleteThx so much, I will try it again.
ReplyDeleteMay I wrote a tutorial to teach orther in Chinese?
(I will state quote from your site and link to this page)
Sure, go ahead.
ReplyDeleteThx, but I have another problem, I found that "no google" did filtered out most traffic from google but I still found "http://www.google.com/imgres?imgurl=" in the table.
ReplyDeleteAnd I also found 1 (not set) too, (total have 3 if not use filter), now I will try use both inclue . & exclude ^$, to see will it filter all (not set) link.
They could be leftover before the filters take effective or leftover within same calendar date.
ReplyDeleteWhen you do something to filter, what data are already in the date will still be there. They may confuse (or trick) you to think filters are not working when you read the report.
That's why I mentioned "create a new profile" in previous profile, it's to make sure no such data appear.
Thx, let me try again.
ReplyDeleteand does the no-redirection filter will drop traffic record from facebook?
I found the traffic from facebook still there
Did the regular expression match the URL?
ReplyDeleteThis links are like this
ReplyDeletehttps://lh6.googleusercontent.com/-Ewk4TziXVi8/T_0YN08pv0I/AAAAAAAAtHE/OGefSAzZifI/s521/facebook.jpg
The RE won't work for m.facebook.com (you can remove www\. part for that kind of URL) but should work for the rest l.php shown in that screenshot.
ReplyDeletePlease wait for daily data reset to make sure, I haven't seen any of facebook redirection in my report. Wait patiently.
Hi, I toke some time to let the filter run (over 48hr), but I still found some filter may not work.
ReplyDeleteas you see, there's still www.facebook.com and http://www.google.com.hk/imgres haven't filter out.
and I attach this profile filter list. Is there anything I missing?
Could you check your RE and see if there are some strange space characters? I found you copy and paste, that would be the case.
ReplyDeletePS. your comment was marked by Disqus as spam, weird.
Thx, there are some strange space characters and I think it's the reason why the filters don't work.
ReplyDeleteThx so much.
P.S. Strange, I seldom leave comment. May be one reasone is I just click on one attachment and the browser bring me to the photo, when I click back, the unfinish comment disappear and I need to make a new comment and retype again. I think this action mark me as a spammer.
I think your comment somehow triggered Disqus spam detection, luckily Disqus still sent me an email notification despite the comment had been marked.
ReplyDeleteHi, I was wondering if this works retro-actively as well or only with new referrals? Not sure if GA stores the whole url? Thanks so much!
ReplyDeleteOnly works for new data. It's because how the filter works. Any changes on filters of a profile will only take effective on new data, the existing data will remain unchanged.
ReplyDelete