Clean Rankings Report in Google Analytics
Joost de Valk has a post up explaining how to track Google search ranking in Google Analytics. The SEO ranking
Tweet ThisWritten by Damon on January 13, 2009
Joost de Valk has a post up explaining how to track Google search ranking in Google Analytics. The SEO ranking hack (Dutch) is by Andre Scholten, he guest posted on Yoast for English speakers.
I added a comment to the post showing how to use this technique to also track Yahoo and MSN rankings as well.
But the ranking report diplays page 1 results as unset, (page: ), page 2 results as (page: 10) or (page: 11). SERPs from subsequent pages are similarly awkward.
If you don’t mind writing a few extra filters, you can display search rankings more intuitively. Here’s how.
Basic Instructions
If you are reasonably experienced with Google Analytics, you should be able to get by with the basic instructions. If you are new to Google Analytics, there are very thorough detailed instructions further down the post.
- Create a profile for your search rankings filters.
- Create filters that include only organic traffic and only traffic from Google, Yahoo, MSN, and Live.
- Create a Custom > Advanced filter to extract search engine rankings using the following settings:
- Field A-> Extract A from Campaign Term: (.*)
- Field B-> Extract B from Referral: (?|&)(start|first|b)=([^&]*)
- Output To-> Constructor: $A1 | page: $B3.
- Create a Custom > Search and Replace filter to format page 1 results on the User Defined field using the following settings:
- Search String: page:$
- Replace String: page: 1.
- Create Custom > Search and Replace filters to format page 2+ results on the User Defined field using the following settings:
- Search String: page: 1[0-1]$ for page 2, page: 2[0-1]$ for page 3 etc…
- Replace String: page: 2 for page 2, page: 3 for page 3 etc…
- Check that the Search and Replace filters are in numerical order.
As you can probably imagine, step 5 can get time-consuming if you are dealing with a lot of sites. I tried number of different arithmetic ways of formatting the results that would have made set up simpler, but none of them worked. Right now, it seems you can’t perform mathematical manipulation of numbers in Google Analytics.
I couldn’t figure out any easier way of displaying the SERPS but if you want to experiment yourself, the Replace String field from the Custom > Search and Replace filter requires a valid regular expression and seems more likely to allow basic arithmetic.
If you plan on using this hack, please be sure to write a whiny blog post about how Google Analytics should let you:
- export profiles to other accounts,
- allow filters to perform basic arithmetic,
- make this hack standard on all accounts.
Maybe if enough of us whine, someone will listen.
Detailed Instructions
Careful step-by-step instructions for people who aren’t very familiar with Google Analytics.
Create Profile for Search Ranking Filters
You need to create a separate profile for the search ranking filters because applying the filters will exclude everyone except for organic search visitors from Google, Yahoo, and MSN.
- On the Overview page, select Add Website Profile.
- On the Create New Website Profile page, select Add a Profile for an existing domain.
- In the Select Domain box, choose the domain you want to track.
- In the Profile Name box, enter Organic Search Rankings (or some similar name).
- Enter Country and Time zone as appropriate.
Filter Organic Traffic
Include only organic traffic.
- On the Overview page, select Filter Manager.
- On the Filter Manager page, select Add Filter.
- On the Create New Filter page in the Filter Name field, enter Organic Traffic (or other similarly descriptive name).
- From the Filter Type box, select Custom Filter and choose Include.
- From the Filter Field box, choose Campaign Medium. I’m really surprised that Campaign Medium works here because all the other campaign options refer to PPC and other links that you can tag with traffic parameters.
- In the Filter Pattern box, enter organic.
- In the Apply Filter to Website Profiles area, select Organic Search Ranking and click Add to apply the filter to the profile.
- Click Save Changes.
Restrict to Google, Yahoo, and MSN
Include only the organic visitors from Google, Yahoo, and MSN.
- On the Filter Manager page, select Add Filter.
- On the Create New Filter page in the Filter Name field, enter Search Engine Visitors.
- From the Filter Type box, select Custom Filter and choose Include.
- In the Filter Field box, choose Referral.
- In the Filter Pattern box, enter (google|yahoo|msn|live).[a-z]+. This regular expression means
- (google|yahoo|msn|live) match one of google, yahoo, msn, or live
- . match a literal period (.)
- [a-z]+ match 1 or more lower-case letters (for the TLD).
- In the Apply Filter to Website Profiles area, select Organic Search Ranking and click Add to apply the filter to the profile.
- Click Save Changes.
Extract Search Ranking from URLs
Extract the term and results page parameters from the referring search engine’s query string and output it to the User Defined report.
Google uses q to identify the term and start to identify the results page in the query string.
- Page 1: http://www.google.com/search?client=opera&rls=en&q=seo&sourceid=opera&ie=utf-8&oe=utf-8
- Page 2: http://www.google.com/search?hl=en&client=opera&rls=en&hs=QB0&q=seo&start=10&sa=N
- Page 3: http://www.google.com/search?hl=en&client=opera&rls=en&hs=tB0&q=seo&start=20&sa=N
Yahoo uses p to identify the term and b to identify the results page in the query string.
- Page 1: http://ca.search.yahoo.com/search?p=seo&fr=yfp-t-501&toggle=1&cop=&ei=UTF-8
- Page 2: http://ca.search.yahoo.com/search?p=seo&ei=UTF-8&fr=yfp-t-501&xargs=12KPjg1ihSroGmmvmnEOOIMLrcmUsOkZ7Fo5h7DOV5CtdY6hNdE%2DIfXpP0xZg6WO8T7xvSy7HBreVFdJGu277WVk0qfeK%5FGr%5FM6c6Vk9AoNdukWnl3tOJ%5F0%2Dmdm6d%2DDA%2E%2E&pstart=6&b=11
- Page 3: http://ca.search.yahoo.com/search?p=seo&ei=UTF-8&fr=yfp-t-501&xargs=0&pstart=1&b=21
MSN uses q to identify the term and first to identify the results page in the query string.
- Page 1: http://search.msn.com/results.aspx?q=seo&FORM=MSNH11
- Page 2: http://search.msn.com/results.aspx?q=seo&first=11&FORM=PERE
- Page 3: http://search.msn.com/results.aspx?q=seo&first=21&FORM=PERE2
- On the Filter Manager page, select Add Filter.
- On the Create New Filter page in the Filter Name field, enter Search Ranking.
- From the Filter Type box, select Custom Filter and choose Advanced.
- In the Field A->Extract A box, select Campaign Term and enter (.*).
- In the Field B->Extract B box, select Referral and enter (?|&)(start|first|b)=([^&]*).
- (?|&) match either a literal question mark(?) or an ampersand (&)
- (start|first|b) match one of start, first or b; Google, Yahoo, and MSN use these to identify starting point in search results
- = match an equals sign (=)
- ([^&]*) match everything until an ampersand (&).
- In the Output To->Constructor box, select User Defined and enter $A1 | page: $B3.
- $A1 get the values from the 1st set of parenthesis in the Field A-> Extract A box
- | page: $B3 write a pipe character and page followed by the value from the 3rd set of parenthesis in the Field B-> Extract B box.
- In the Apply Filter to Website Profiles area, select Organic Search Ranking and click Add to apply the filter to the profile.
- Click Save Changes.
Format Page 1 Results
The query string parameter identifying the results page parameter for Google, Yahoo, and MSN are all unset on the first page, so you need a special rule to format page 1 results.
- On the Filter Manager page, select Add Filter.
- On the Create New Filter page in the Filter Name field, enter Page 1.
- From the Filter Type box, select Custom Filter and choose Search and Replace.
- In the Filter Field box, select User Defined.
- In the Search String box, enter page:$.
- The dollar sign means match page: where it appears at the end of the string. Without it, the filter would match every occurance of page:.
- In the Replace String box, enter page: 1.
- In the Apply Filter area, select Organic Search Ranking and click Add to apply the filter to the profile.
- Click Save Changes.
Format Page 2+ Results
Match results pages starting at result #10 or #11 and change to page 2.
Google starts counting results at 0, so page 2 results start at #10. Yahoo and MSN start at 1, so page 2 results start at #11.
Off topic: you can hand edit the query strings to start anywhere you like letting you put result number 5487 first. So don’t trust screenshots showing top results in Google & imitators.
- For every search results page you want to track, on the Filter Manager page, select Add Filter.
- On the Create New Filter page in the Filter Name field, enter Page 2 (or 3 for page 3, 4 for page 4 etc…).
- From the Filter Type box, select Custom Filter and choose Search and Replace.
- In the Filter Field box, choose User Defined.
- In the Search String box, enter page: 1[0-1]$ (or page: 2[0-1]$ for page 3, page: 3[0-1]$ for page 4 etc…).
- page: 1[0-1] match page 10 or 11
- $ where it occurs at the end of a line.
- In the Replace String box, enter page 2 (or page 3 etc…).
- In the Apply Filter area, select Organic Search Ranking and click Add to apply the filter to the profile.
- Click Save Changes.
Check Filter Order
Filters in the wrong order can mess up your results. Of particular concern are results from pages 10 or 11, 20 or 21, 30 or 31 etc…
Put your page: x rules in numerical order. If your page 10 or 11 rules comes before your page 2 rule, then page 10 or 11 results will be converted to (page: 10) or (page: 11) which will then match page:10 for Google or page: 11 for Yahoo and MSN. These will then be converted to page 2 when they pass through the Page 2 Search and Replace filter messing up your results.
Otherwise, filters are probably fine in any order because they act on different fields, in ways that are not mutually exclusive, or on fields that aren’t set until they pass through a filter. But I can confirm that the following order works:
- Organic Traffic
- Search Engine Visitors
- Search Ranking
- Page 1
- Page 2
- Page 3 etc…
To set filter order:
- From the Overview page, click Edit for the Organic Search Ranking profile.
- On the Profile Settings: Organic Search Ranking page, scroll down to the Filters Applied to Profile section and click Assign Filter Order at the top right of the section.
- Adjust filter order as necessary.
- Click Save Changes to finish.
View the Results
It takes about a day for Google to update your profile with the new filters.
To view the report:
- In the Overview page, select the Organic Search Ranking profile.
- In the left sidebar, click Visitors to open the menu for all visitors pages.
- At the bottom of the list of visitors pages, click User Defined to see the results.
When you are done with this, you might want to check out my post on segmenting the ranking report by search engine.