Tracking Keyword Ranking Position with Google Analytics

Google recently announced a change in the format of the referring URL for visitors finding your site through keyword searches.

The new format promises to reveal much more information about the search result rankings that was previously available, and this post will show you how to take advantage of that information to tune your SEO efforts using Google Analytics.

Starting this week, you may start seeing a new referring URL format for visitors coming from Google search result pages. Up to now, the usual referrer for clicks on search results for the term “flowers”, for example, would be something like this:

http://www.google.com/search?hl=en&q=flowers&btnG=Google+Search

Now you will start seeing some referrer strings that look like this:

http://www.google.com/url?sa=t&source=web&ct=res&cd=7&url=http%3A%2F%2Fwww.example.com%2Fmypage.htm&ei=0SjdSa-1N5O8M_qW8dQN&rct=j&q=flowers&usg=AFQjCNHJXSUh7Vw7oubPaO3tZOzz-F-u_w&sig2=X8uCFh6IoPtnwmvGMULQfw

What does that mean for me?

Common speculation is that the cd parameter in the referral URL indicates the position of your page in the search results, and this has been confirmed by Matt Cutts.

Knowing what position your pages hold in the SERPS for a given keyword can be enormously helpful to your SEO efforts, so it makes sense to start tracking this new data. Prior to the change in referer, it was possible to track your SEO rankings with Google Analytics, but you could only get information about the page on which you were ranking for a keyword search, not your overall position.

Create a New Profile

You are definitely going to want to create a new profile within Google Analytics so that you do not interfere with the data that is already being collected for your site (The profile that we are about to set up will only capture data for organic search results from Google that use the new referer string).

Sign in to your Google Analytics account and “Add a Profile for an Existing domain”. You can give it any name you like, I chose to use “Google SERP Ranking”.

step-1-create-new-website-profile

Create the Filters

The first thing that we need to do is create a couple of filters to make sure that only organic google searches are included in this profile. Order is important, so make sure that you either create your filters in the order that they are described here, or that you go back when you are finished and reorder them appropriately.

1. Include Organic Search Results

Create your first custom include filter using the Campaign Medium filter field and a filter pattern of organic.

step-2-include-only-organic-search-results

2. Include Google Search Results

Create another custom include filter using the Campaign Source filter field and a filter pattern of google.

step-3-include-only-google-searches

3. Include New Google Referral URL

Create the final custom include filter using the Referral filter field and a filter pattern of google.com/(search|url).*\bcd=\d*.

step-4-include-new-google-referer

4. Extract Keyword and Ranking Data

The last filter we need to create is an advanced filter that will extract data from the referal string and create custom output that will be viewable in our reports. Create an advanced custom filter, and set the pulldowns, text areas and radio buttons as shown in the screenshot. This will extract the keywords and SERP position from the referal string and replace the output with our own custom string in the format <keyword> (Rank: <position>)

step-5-construct-output

For clarity, here are the three regular expressions from the previous screenshot:

\bq=([^&]*)
\bcd=(\d*)
$A1 (Rank: $B1)

Visualizing Results

Once you have created the new profile and filters, and have started receiving traffic, you should be able to see the keyword/ranking data in any of your reports when you change the dimension to User Defined Value.

results

Please share your experiences with this or any other helpful Google Analytics tricks that you use!

Update: You can also replace the %20 with a space in your reports by adding some additional filters

Chris Abernethy
PHP Wrangler, MySQL DBA, Linux SysAdmin and all around computer guy, developing LAMP applications since Slackware came on 10 floppy disks.

Got something to say? Go for it!