Tracking Referrals from Second Page of Google in Google Analytics

I have been experimenting with some advanced features in Google Analytics over the last couple of days. I was inspired by some very clever insights from Search Laboratory (sphinn it here) that we have found very useful.

I wanted to be able to use Google Analytics to find referrals from the second (and greater) pages of Google search results (details at the end on how to do this for Yahoo! and Live). We find this data hugely useful during SEO projects because if you are ever getting decent traffic from page 2 (or any traffic from pages 3+) that indicates a huge opportunity for increased traffic. Sometimes this can be done just with on-page changes, sometimes it needs some more links, but it’s almost always worth it. Up till now, we have had to gather this data with additional third-party tools or log file analysis, but since the vast majority of our clients use GA, it is worth the effort to work out how to do it.

So enough fluff. How do you do it?

Start by creating a new profile for the site:

Note that Google Analytics profiles do not dynamically apply to previously-collected data, unlike segments which make an appearance later in this technique, so you need to do this in advance of needing the data.

Once you have a new profile, edit it and add a filter:

Set that filter up exactly as this image shows:

The text in the Field A —> Extract A box is (?|&)(start)=([^&]*)

This is a regular expression which extracts the parameter called ‘start’ from the referring URL. Google uses this to determine which page of results to display (page 2 is start=10, page 3 is start=20 etc. for anyone with the default settings of 10 search results / page). If you want to set this up for Yahoo!, they use a parameter called ‘b’ and b=11 is page 2, b=21 is page 3 etc. Live uses the same numbering scheme with a parameter called ‘first’. So replace ‘start’ with ‘b’ for Yahoo! and ‘first’ for Live (and remember that you need a different segmentation below).

Once you have your filter defined, that includes the output into the User-Defined field (that is what $A3 means in the Output To text box). When you go into your reports, you can now see data broken down by this. That isn’t quite what we want though - we want to see referring keywords that come from specific pages of search results. To do this, we need the new feature in GA called ’segments’:

Click on the drop-down and add a new segment:

Set it up as shown above (user-defined value is under the ’Visitors’ dimension). If you want 2nd page referrals from Google, you want matches exactly = 10 (I find it useful to have a segment for that and another for pages 3-5). If you are setting up a segment for Yahoo! or Live, and set the filter up appropriately for them above, then you will need 11 / 21 / 31 etc.

Once you have this segment, you can apply it to any report you like:

Apply it to your organic keywords report, and you’re good to go!

On another subject entirely...

For those of you not just interested in learning about Google Analytics, I published a post earlier today called SEO agency for sale? (just before disappearing off for 3 weeks’ holiday). If that headline isn’t enticing....

Late update

Joast’s site has just published this post which gives a nice addition to the method that includes the referring page in the keyword data.

Will Critchlow

Will Critchlow

Will founded Distilled with Duncan in 2005. Since then, he has consulted with some of the world’s largest organisations and most famous websites, spoken at most major industry events and regularly appeared in local and national press. Will is part...   read more

Get blog posts via email


  1. very cool experiment but couldn't you just upgrade to a better stats programme like, they show absolute referrers

    reply >
  2. Will, that's awesome. I'd never considered doing that, but I certainly do see the value - thanks for sharing the tip. bookmarked.

    reply >
  3. Dorian

    Thanks for posting this. I've been looking for a way to see this referral information in Google Analytics.

    You would think Google would have this information setup by default. It's kind of pain to setup all these filters/profiles for all my websites. And even after I do it, I still miss out on some referrals (like if someone has their results set to display 100 at a time, etc).

    I would prefer to use another Analytics program, but now that Google links Adsense data with Analytics, it's a must-use for Adsense sites.

    I wish Google would look at the user interface of Get Clicky analytics. They could learn something.

    reply >
  4. Will, great write-up and work around with Google Analytics. We've begun testing out Enquisite Analytics which offers something similar, but it's good to know that it is possible to do this with Google Analytics.

    reply >
  5. Interesting stuff and awesome article. I'll sphinn it.

    Analytics is awesome and any additional features we can utilize it for will make us that much stronger in days to come.

    Good stuff.

    reply >
  6. You've written:

    "The text in the Field A –> Extract A box is (?|&)(start)=([^7]*)"

    But on the screen there is no "7" but "&". But that's a detail - Thanks very much for this filter!

    reply >
  7. Great Post Will - not something many people would have thought of doing but very useful

    reply >
  8. The filter doesn't seem to be working. Is it because there is an &sa=N on the end of the google search url now? I've can't seem to think of what could be wrong. Any ideas?

    reply >
  9. Good spot Bartek. Fixed!

    Alice - there are loads of parameters that can be in the string (sa=N is common). That shouldn't stop it working - can you check that you have everything set up as per the screenshots (pay attention to Bartek's comment above as there was a small error in the original post). Let me know if it's still not working. Sorry it's taken me a while to reply - I was away on honeymoon!

    reply >
  10. That's three posts today about using advanced reports in Google Analytics. Guess I need to go play in that today huh? :) Thanks Will :)

    reply >
  11. hi Will - great stuff - was looking at this before xmas but it was Joost's and Scholtens blog post that spurred me into action on this!
    Is there a custom filter for the first page SERPs?
    As obv got 2nd page(10), 3rd page(20) etc - but first page is a 0
    Presume it would be "user defined value, matches exactly - 0"

    reply >
  12. Hi Rob,

    Unfortunately not - you can't do that as the "start" parameter is often not there when you just do a search - it only appears when you go to page 2, 3 etc.

    You want:

    user defined value
    does not match regular expression

    The [0-9]* regular expression means "any number" so what you are saying here is that you match the segment where your user defined value is not a number (normally means it's not present). I've just tested that and it works fine for me.

    reply >
  13. Will

    What I would be interested to know is what impact would SearchWiki results have on tracking whether the referring traffic came from the second page etc?

    Ie. if a user has upvoted a particular result to page 1 - if they click on that link in the future, based on your experiment here, what that referrer be classed as a page one? Even though the true page it was referred from was page 2, 3 etc?

    Just a thought...


    reply >
  14. Will,

    Thanks a lot for putting this guide together, great stuff. I got it working, and created segments for 2nd, 3rd, and 4th page. I'm a little confused though - When I apply this segment to keywords, why do some keywords (usually longtail) show up, but have zero visits? If there were zero visits from that keyword, why would it show up in Analytics in the first place? This only happens with "paid", obviously meaning Adwords. Any idea?

    reply >
  15. Hi John,

    Glad it's helping. I have been confused by these "zero" visits too. I'm afraid I don't know the answer - but I have dropped Avinash Kaushik a line - if anyone knows the answer, he will!

    Hopefully he'll stop by and shed some light on it for us.


    reply >
  16. John: Here is one scenario where you might see Zero Visits...

    If you come to my website on the keyword "iPod" and then you go back to Google and come back my website on the keyword "iPhone" in less than 29 minutes then in terms of giving "keyword credit" for that visit (remember it is the same session), iPod will show Zero visits and iPhone will show one visit.

    As you can imagine the application is doing a balancing act between not making decisions for you (dumping the first keyword) and showing you something that might be of value. Tough act. : )


    PS: There is another scenario where you might see zero visits. If your adwords account is linked to GA and you use the paid search keywords reports in GA then some of the cost reports you can see a keyword with 0 visits too - that is because you could have had impressions for a keyword with no visit and since in Analytics the cost information is imported these keywords can still show up in GA reports.

    reply >
  17. Thanks Avinash. That makes perfect sense - great explanation.

    reply >
  18. Paul - sorry for replying out of sequence - just seen your question. This tracks the actual page that someone clicked on - which means if they have customised their results and see you on page 1, then page 1 will show in your analytics. There is no way to know where you "should" have ranked. This impact of personalisation of search is one of the big reasons rank checking is a declining benefit...

    reply >
  19. Will, Great post! I've enjoyed having this on my Analytics and it's opened my eyes to some interesting stuff going on at my site.


    reply >
  20. Will,

    Oddly enough, I saw the post on SEOmoz earlier today regarding this exact issue? Any chance I was the inspiration for your post? Haha, anyway, thanks a lot Avinash and Will, it's very much appreciated, and that makes perfect sense to me now.

    reply >
  21. Yes - you were (I linked to you in the 'moz post, I think!).

    reply >
  22. Avinash,
    On keywords showing 0 visits in GA ... I buy your 29 minute explanation (good one!). But I don't understand your PS - are you saying that unclicked Adwords impressions are recorded in GA sometimes? If it happened all the time GA would be a mess! Have I understood you corrrectly?

    Could repeated clicks on the same ad (same keyword) within 29 minutes cause it? I think so.

    Cheers! (Thanks also to Will)

    reply >
  23. Mimi

    Hi! Does this works only with I mean, will it work with let's say

    I've been using this technique for a couple of days, and altough I have 6000+ visits por day, this filters only about 200+ visits.
    Is that correct?

    Maybe it's only filtering visitors?

    reply >
  24. Phil

    Hi Will,

    Could I suggest an alternative version of the above RegEx:

    Referral [?&#]start=([^&]+)&

    If their is no trailing "&" e.g. &sa=N is missing on start=10&sa=N this will work instead:

    Referral [?&#]start=([0-9]|[1-9][0-9]|100)
    UserDefined $A1

    If you want to be really clever , here is a version that works on googe, yahoo & bing...

    Referral ^https?://(www||||[?&#][qp]=([^&]+).?#&=([0-9]|[1-9][0-9]|100)
    user-defined $A3 ($A2 page:$A5)

    result would be... (keyword page:10)

    Note: page1 (start=0 is not always shown in google referral url)

    Gogin off topic but you can aslo store KW position if cd= is present:

    Referral ^https?://|[?#]hl=|search|webhp|url).[?#&]cd=([1-9]|[1-9][0-9]|100).&q=([^&]+)&(?!&oi=(spell|revisions_inline|broad-revision|social_search|blog_result|microblog_result))
    medium ^organic$
    UserDefined $A4 (google.$A1 position: $A3)

    result would be... keyword ( position:3)

    Also there is a really cool plugin called seopositionplus.js which stores position using the integer field in eventTracking report in GA:



    reply >
  25. Phil

    May I suggest an alternative way to do this using RegEx.

    Referral [?&#]start=([^&]+)&
    User-Defined $A1

    Or if no trailing "&" at the end of the url e.g start=10& you can use this instead:

    Referral [?&#]start=([0-9]|[1-9][0-9]|100)
    User-Defined $A1

    Here is a version that works on googe, yahoo & bing:

    Referral ^https?://(www||||[?&#][qp]=([^&]+).?#&=([0-9]|[1-9][0-9]|100)
    medium ^organic$
    User-defined $A2/kw=$A3/page=$A5

    result would be...
    Note: page1 (start=0 is not always shown in google url)

    Going off topic but you can also store KW position if cd= is present:

    Referral ^https?://|[?#]hl=|search|webhp|url).[?#&]cd=([1-9]|[1-9][0-9]|100).&q=([^&]+)&(?!&oi=(spell|revisions_inline|broad-revision|social_search|blog_result|microblog_result))
    medium ^organic$
    UserDefined google.$A1/kw=$A4/position=$A3)

    result would be...



    Also check out the seopositionplus.js script to store position using the integer field in eventTracking tracking:

    reply >
  26. So, could I then alter the regular expression from (?|&)(start)=([^&]) to (?|&)(start|b|first)=([^&]) to encompass all three search engines, then just use different segments for each?

    In this case, each segment would require both the source (search engine) and the user defined value (unique to each search engine), correct?

    reply >
  27. thnx a lot this is really worth reading and the point that Avinash is damn good for someone like me.

    reply >
  28. Another incredibly awesome post from Distilled.

    Thanks Will! By the way, also really enjoyed your presentation regarding link building in Seattle, very helpful.


    reply >
  29. Thanks for the step by step detail. Still took me a bit to get it going- but thanks a bunch.

    reply >
  30. awesome man wondering how to do this for a while ;)

    reply >
  31. Awesome post. Very informative. I never knew you can use Google Analytics like that.

    Thanks for the share.

    reply >
  32. Thomas King

    I pressume that this is made all the more difficult with the increase in the number of searches returning 7 results on the first page? How would you recommend altering this process in order to account for this?


    Thomas King

    reply >
    • Will Critchlow

      Hi Thomas,

      There have been all kinds of changes since I wrote this post - including the ajax-style search results that change a lot of the parameters that get passed around.

      I haven't dug deep into the details recently but would be interested to hear if you discover anything.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>