Browsing articles tagged with " advanced filters"
Dec 7, 2010

Track SEO Organic Rankings with Google Analytics

In April 2009, Google announced that they were making some changes to how the referral URL would look like on their search engines.

One of the key information that’s provided here is the listing’s organic ranking (cd parameter). This can be found in the referral URL property (or document.referrer when referring to the DOM).

It’s been more than 1.5 years since the announcement so I figured that the gradual roll out would be almost complete (I still see instances of the old referral URL being used though) so I decided to implement a filter for Google Analytics that will pull in the organic ranking data and show it in the keyword reports.

Before we get into it, there’s something important to know about the cd parameter. Traditionally in SEO, we’ve always known the SERPs to contain 10 organic listings (as shown below).
Continue reading »

Jul 11, 2009

Google Analytics: Advanced Filters Guide

Thought I’d share a post on how to use advanced filters in Google Analytics and what are some scenarios where they can come in handy.

Advanced filters are very useful for extracting information from available fields (i.e. campaign source, campaign term) using regular expressions and then using the extracted information to manipulate other fields in Google Analytics so that you can customise how data is recorded in your reports.


First of all, before you use advanced filters, it is important that you have some kind of basic knowledge on regular expressions. If you don’t, then perhaps it’s a good idea to read up on what those cryptic symbols mean and how they’re very useful in pattern matching.

Continue reading »

Apr 5, 2009

How To Track Sub-Domains / Cross-Domains in Google Analytics

First of all, let me explain why in Google Analytics you need to do some configurations to track sub-domains / cross-domains.

Google Analytics does not do this by default, thus whenever you’re on and you go to, Google Analytics will record this as a referral rather than maintaining the same session and the same campaign information. If you’re running e-commerce tracking and you use sub-domains during the e-commerce process, this will totally screw up your reports as it will attribute all transactions to referrals (from your own site) and you will have no idea how your other online marketing campaigns (i.e. direct, organic, cpc) are performing.

Sub-Domain Tracking

This one is fairly easy. The method you need to use is _setDomainName().

Google utma cookie

The _setDomainName() method sets the Google cookies to the domain name string parameter that it is given, otherwise it automatically resolves the domain name from the location object in the DOM if no parameter is given. This means that on sub-domains, the cookies will be set to separate sub-domains.

So to configure Google Analytics to set the cookies to the same domain name, simply use the domain name as the string parameter for the _setDomainName() method.

E.g. If I have a website called and, I would use _setDomainName(‘’) throughout all my pages (sub-domains and main domain).

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x"); // replace this with your own account number

The Google API officially states to use the period at the start of the domain name. I have tried with and without and it seems to work fine but I prefer without period (looks nicer).

Once you’ve done this, Google Analytics should record all visits to these sub-domains as the same visit, maintaining the same campaign information. However, in your reports,you won’t be able to tell which request URI came from which sub-domain as the domain name is stripped out from the reports.

In addition, if you have two sub-domains that have the same page name (i.e. index.html), then Google Analytics will combine these two into one which will artificially inflate your page statistics.

A simple way around this is to implement what I call a sub-domain visibility filter which will prefix your request URI’s with the domain name. This will help you differentiate the pages as well as avoid inflating the page statistics.

Continue reading »

Mar 7, 2009

Google Analytics: Adding True Search Query Terms Using Advanced Filters

In Google Analytics keywords report, you can only segment the keywords by total, paid and non-paid, which pretty much means total, non-cpc and cpc. Also in the keywords report, whenever someone arrives to your website via a cpc medium such as Google Adwords, it will only report the keyword matched in your adgroup keyword list, but not the true search query the visitor typed in.

With a little help of Google Analytics’ custom advanced filters, you’re able to show in your reports what the true search query was and segment it by mediums.

search query report

The screenshot above is an example of how the report will look like after the filters are applied. As you can see, within the brackets is the true search query used on search engines and other shopping portals (i.e. Lasoo,, Shopbot). Of course this example doesn’t show any cpc medium because I don’t run any cpc campaigns. Sponsor me and I will :)

This is pretty handy to see on your reports because now you’re able to segment your keywords by medium as well. Of course you could probably use advanced segments to do this but this incorporates true search query and segmentation at the same time.

So the first step I would recommend is to make sure you set up a test profile. You can skip this part and work on your main profile if you like.

To do so, go to your analytics overview dashboard and click on Add Website Profile. Make sure you select the Add a Profile to an existing domain and from the drop down menu, select your website domain.

new website profile

You can name it test profile or whatever you like as long as you know it’s a test profile. Pretty much this is your hack and abuse profile where you do experiments and tests on it so that it doesn’t affect your main profile’s reports. Once you’re happy it’s working correctly, you can move your filters etc. to your main profile.

Now the next step is to determine your regular expression to extract search query terms from your referral URLs.

Continue reading »

Twitter Updates