In the past I’ve written about different ways to customize Google Analytics for SEO. This post is all about a new way to track keyword ranking using Google Analytics.
A little background…
There are lots of paid tools that will track where your content ranks in your search results. But my friend AJ Kohn wanted to try and develop a free way to measure rank with Google Analytics.
Actually, he had a brilliant idea: measuring the individual keyword rank, group keywords together into indexes and then track the average rank of those indexes over time – all with Google Analytics.

Track the SEO rank of keyword groups, or indexes, using Google Analytics.
Image courtesy of AJ Kohn.
Here’s how AJ describes a rank index:
A rank index is the aggregate rank of a basket of keywords that represent a type of query class that have an impact on your bottom line. For an eCommerce client you might have a rank index for products and for categories. I often create a rank index for each modifier class I identify for a client.
It becomes not about any one term but the aggregate rank of that index. That’s a better conversation to have in my opinion. A rank index keeps the conversation on how to move the business forward instead of moving a specific keyword up.
After a little brainstorming and testing we think we have a method to do this and would love your feedback.
How This Works
Here’s the general idea:
1. Someone clicks on an organic search results
2. The user lands on your site
3. A custom piece of code that you install on your site collects the keyword and the rank of the result using a Google Analytics event
4. Google Analytics will automatically calculate the average position for the result
5. You create indexes of keywords and analyze the data using the Event reports OR Excel and the GA API
That’s it. Nothing more.
Let’s dig into some of the details of how this work.
The Code
The code is relatively simple. All it does is looks at the referring URL and, if it’s from Google Organic, plucks out the location of the search result and sends it to Google Analytics using an Event.
Here’s the code – feel free to copy it and use it. You do not need to customize the code for your site.
This section of the code parses out the keyword and the search result location. The search result location is stored in a query string parameters named cd
.
var myString = document.referrer;
var r = myString.match(/cd=(.*?)&/);
var rank = parseInt(r[1]);
var kw = myString.match(/q=(.*?)&/);
Next there is a check to see if the keyword is (not provided). If it is (not provided) then we make sure that we track the keyword as (not provided).
if (kw[1].length > 0) {
var keyWord = decodeURI(kw[1]);
} else {
keyWord = "(not provided)";
}
Finally we send the data to Google Analytics using an event:
_gaq.push(['_trackEvent', 'RankTracker', keyWord, p, rank, true]);
For those of you that have not used events, there are 5 parts to an event:
- Category: This helps you categorize the events and separate them in the reports.
- Action: What happened that you want to track?
- Label: Provides more information about the Action.
- Value: Some numerical value for this event.
- Noninteractive: This is a flag, it tells Google Analytics if this event should impact bounce rate and time calculations. If you have no idea what this means read about how Google Analytics calculates time.
For this tracking technique we’re sending the following data with the event:
- Category:
RankTracker
– all of the data will be grouped under the Event named RankTracker. - Action:
[keyword]
– the action will collect the search term the user entered on Google. - Label:
[landing page]
– the label will be the landing page that the user landed on. - Value:
[SERP rank]
– rank of the search result will be collected for each keyword. More on this in a second. - Noninteractive:
TRUE
– this event will NOT change your bounce rate calculations.
The most important thing to understand is that the rank of the search engine result will be tracked as the value of the event. So as you get more and more visits from a keyword the TOTAL VALUE of the event for that keyword will increase.
Google Analytics will also create an Average Value metric for each keyword event. This value will actually represent the Average Rank for each search result.
Let me say that again.
Using this technique Google Analytics will automatically calculate the average position of your content in the search results.
I also want to point out that this data is generated from real clicks to your site. It’s actual people visiting your site and (hopefully) converting. To me, this makes it a lot more valuable than just tracking ranking that does not result in clicks or conversions.
So that’s how this technique actually works. As I mentioned, all you need to get the data is install the code on your site. Just make sure it appears AFTER the standard Google Analytics page tag.
Raw Ranking data in Google Analytics
Ok, let’s look at some data. It’s all event data, so let’s go to the Content > Events > Top Events report. I’m looking for the RankTracker event category.

You can find rank tracking data in the Google Analytics Event report.
Clicking on RankTracker I see all the actions for that event, which are really just the search terms.

The search terms and ranking are stored as Google Analytics Events.
Here’s the cool thing. Remember that the Average Value metric is actually the Average Position for each of those keywords. So for the time range that I’m looking at I’m seeing the average position for each keyword.
Let’s play with this.
Change the data over time graph to plot the metrics Average value. Now you can see the average ranking for all your search terms over time.

Change the plotted metric to see your average search result rank change over time.
You can also select multiple rows and plot the Average Value to see how the ranking changes for specific keywords over time.

You can view the changing rank of your keywords by plotting multiple rows.
Another cool type of analysis you can do is use a secondary dimension to view the landing page for each keyword. The landing page is stored in the Label portion of the event. This is something a lot of people do to measure (not provided)

View keyword, landing page and Average SEO rank in Google Analytics.
Now we have keyword, landing page and the average ranking in one report.
We can also group keywords together into an index. The easiest way to do this in Google Analytics is using an Advanced segment. Again, a lot of credit to AJ for explaining how he does this.
For something simple like my blog I can create a segment based on my name and the Analytics Talk brand. That makes it easy to view the performance of that group of keywords.

Create an Google Analytics Advanced Segment to group keywords together into an index.
While I can do analysis within Google Analytics, the real value is exporting this data to excel and producing more detailed report. AJ covers that nicely in his post. I’ll post some other methods next week.
Actionability
The entire reason you should collect this data is to measure how your actual content-creation tactics are working. It’s granular data that helps support your overall strategy of “content marketing.”
If you’re not getting valuable traffic from content and keywords that you are optimizing for then you need to re-evaluate your tactics and change.
Caveats & Things to Remember
First, this data is only for traffic coming to your site. It does not give you the ranking for search terms if you are not getting traffic.
As mentioned above I actually like this approach. If I’m not getting traffic/conversions then my ranking sucks. I need to create better content.
Second, Google blocks the referring keyword data for secure search queries. This includes logged in users, people using Safari on iOS 6 and Firefox. There are no analytics tools in existence that will provide the blocked keywords. In Google Analytics you’ll see the keyword (not provided) in your data. You’ll also see (not provided) in this data.
So there you have it. We (me and AJ) hope that this techniques helps people track rank freely and more effectively. Feel free to innovate and develop on top of it and let us know what you think.
Great idea. I may use this in a couple of areas, although I would also like to collect Bing search data. I haven’t parsed the referring URL before to collect data in this way. Does Bing pass along the same info in the same way?
@Jay: I’m not sure of the Bing referrer. But if anyone knows the format this script can easily be adjusted to track ranking in Bing.
Instead of using document.referrer.match(/google\.com/gi) for detecting Google referrer, it may be a better option to use document.referrer.match(/google\./gi) so it would work for google.ca, google.fr, google.es, etc also.
@Sebastian: Get advice, thank you sebastian. I’ll put that on the list. I’ve also been thinking about segmenting based on different types of search, like image, etc.
I was thinking exactly the same than Sebastien. For international scenarios it’s key.
I’ll try and see what the outcome is in that sense.
This seems really promising. At our agency, we take rank tracking data for groups of keywords (we call them keyword buckets) and run them through a proprietary spreadsheet that assigns a percentage of visibility score based on the keyword rank. This produces an aggregated visibility score for each keyword bucket. We find it much more productive to talk to clients about SERP visibility for groups of keywords that represent product or solution groups, as opposed to having them focused on the rankings for a specific keywords. I think this is analogous to the keyword index as you describe it. I would really be interested in developing this kind of report in GA.
@Colby: You can source the data for your spreadsheet using the code in this blog post. Once it’s in Excel you can use your proprietary methods to massage it into buckets and calculate visibility. In fact my post next week will be about automatically extracting the data using the Google Analytics API and putting it into Excel.
Hi, thanks for this Justin, a great idea, I didn’t realise ranking position came through in the referrer too. Handy!
One small change I would recommend is to replace the “(/google\.com/gi)” with “(/google\./gi)” just because then it will track the localised versions of google search also (i’m using google.co.uk and your script will not track me as it is, if you make that change it will track me)
Thanks again, great use of events here. I’ll definitely be using it.
@Ross: Great suggestion. Sebastian also made the same suggestion – and I agree that it could be very useful to segment the data. I think we’re going to collect feedback for a while and then modify the script. Another suggestion was to isolate image search traffic.
DO you have to make any changes to your Google Analytics Account?
Thanks.
@Kevin: You don’t need to make any changes to your account, but you do need to add the extra code to your site.
Does the code need to be in all pages across the site ?
@Pradeep: Technically, yes, it should be on all pages. The reason is that people can land on any page of your site. Every page is potentially a landing page from a search engine.
Stupid question: is this code JS or PHP? Does it belong in the head or body? I’m experimenting with it now. If it works – it’s genius!
@Steve: This is JavaScript. The code should go after the standard your Google Analytics page tag.
Ah so in the header? I’ll have to move it, I guess JS and slapped it in the footer. Thanks Justin!
@Steve: Footer should work too. Doesn’t really make a big difference. I usually like to keep all my analytics code together – it’s neater. Unless is causes performance issues. But this shouldn’t.
Can’t wait to put this in place. Thanks!
Last time I looked, there looked like there was a decreasing amount of q= parameters in my data set, but I suppose data from some is better than none.
Can you somehow figure out how to do this for AdWords too?
@Placo: The ranking is stored in the cd query parameter. I’m not 100% sure of the coverage of this parameter, you can check out AJ Kohn’s post about rank index for more information. The best way to track AdWords is to enable Auto-Tagging in Google Analytics and use the Advertising reports.
Can you provide me a screenshot of how the code may look like? I’m little bit confused with the usage of this code. How exactly it should be placed in footer or header file? A screenshot would help a lot.
@Kinjai: Sorry for any confusion. But as long as it appears after the standard Google Analytics page tag it will work. So you can put it in the header or the footer. Hope that helps.
I am currently using a filter to track rankings within GA explained here in Yoast http://yoast.com/track-seo-rankings-google-analytics/ Is there any advantage when I use this event tracking method?
@Nikhil: Yoast’s method (which I like very much) tracks the number of the first result of the page the keyword was on. this method tracks the actual rank locations. But the big advantage of this method is that it will automatically calculate the average rank for each keyword over time. That’s the advantage of using the Event. It collects the rank as an actual metric, a number, that is averaged over time.
I hope that clarifies the difference.
Thanks for the question.
Thanks Justin for clarifying my doubt. It seems like I provided the wrong link in my previous comment. I was using a filter which tracks the position of my webpage for a particular keyword when user clicks on Google search results. That method is explained here in Yoast http://yoast.com/track-seo-rankings-and-sitelinks-with-google-analytics-ii/ But had its disadvantages. Because it doesn’t add the position for every keywords. The reason may be Google doesn’t add the cd parameter everytime in its search result URLs.
I have implemented this event tracking in one of my website. Thanks Justin!
Now we have a better way to see at what position we rank for (not provided) :D
@SEOKungFu: Yes we do! Just a little more insight than we had before.
Wow!! It is great..I’ll use in my current project and see the result..
Thanks a lot Justin for sharing this info…..
I’m using a GA filter to extract the keyword ranking information, using the user defined dimension. I can’t remember where I got the idea from originally, but here’s the settings:
Custom Filter > Advanced
Field A : Campaign Medium // organic
Field B : Referral // (\?|&)cd=([^&]*)
Output to: User-Defined // $B2
Yes // Yes // Yes // No
As we’re working with clients, I’ve always preferred to keep the code changes on their websites to a minimum.
What are your thoughts on the pros and cons of each method?
@Sjors: That’s a method that my friend Yoast blogged about a while ago. It certainly works great. As I mentioned in another comment the big benefit of this method is that it will actually calculate the average rank for each keyword. Then you can trend that over time, group keywords together into an index and trend the index over time, etc. Or you can export the events to Excel and create some nice reports. More on this in a later blog post.
is it possible to load the script using Google tag manager ?
@Andrea: Love this question! If you’re using the Google Analytics template then NO, it will not work. The reason is that GTM executes all of the tags asynchronously. However, there is a workaround:
1. Take your GA code and past it into a Custom HTML template
2. Add this rank tracking script to the same Custom HTML template
3. Add the template to all the page on your site
Hope that makes sense and thanks for the great question.
Brilliant idea and quite safe, because i could add an additional profile and keep the event tracking inside that profile. :)
If the GA code is inside the pages (the usual) , may i add a custom html TAG to track events inside that profile ?
@Andrea: Yes, you could do that. You could create a new web property in Google Analytics, then use a Custom HTML template to add the new GA tag and this tracking script to your site.
I confirm that the suggest usage works perfectly inside GTM!
May i ask you why some keywords are tracked with “+” as space separator ?
Eg: “chi+deve+effettuare+i+gas+di+scarico+delle+auto” (sorry for the italian language)
I’m using the Google Tag Manager plugin for WordPress and have created the Custom HTML template with the GA tracking code and the added code for tracking keyword ranking below it in the same template. I am getting no data. Is there a workaround for the WordPress plugin?
@Michael: The problem with GTM is that the tags load asynchronously. It may be that your custom tag is loading before your GA tag. Try removing your GA tag and putting your GA code in the custom container. Test, test and then test some more. Hope that helps.
Wonderful.
The main interest I see is to know the exact mean position your keyword has in Google. With traditional tools you only get your position in private navigation without the “local” correction.
I am sure that you get very interesting stats. We will try this very soon.
Thank you.
Another version :
if (document.referrer.match(/google\.([a-zA-Z]{2,5})/gi) && document.referrer.match(/cd/gi)) {
var myString = document.referrer;
var r = myString.match(/cd=(.*?)&/);
var rank = parseInt(r[1]);
var kw = myString.match(/q=(.*?)&/);
var moteur = myString.split(‘/’)[2];
if (kw[1].length > 0) {
var keyWord = decodeURI(kw[1]);
} else {
keyWord = “(not provided)”;
}
var p = document.location.pathname;
_gaq.push([‘_trackEvent’, moteur, keyWord, p, rank, true]);
}
@JCB: Thanks for posting this code. For those that are wondering this code will track rank for any Google property, not just the .com domain. I have not tested this code but it looks like it should work great.
Thx @Cedric & Sébastien from CyberCité !
Is this will work with Google.com.sg or Google.co.jp?
@Nuttakorn: My version of the code will not. But others have posted versions that will work with other Google domains.. I have not had a chance to test them yet.
Hey Justin (and AJ) – Thanks for the great post!
Forgive my noobie question, but will ecommerce data come into this event? Basically, will I be able to look at visits, average position, and revenue and transaction data for each keyword from this code?
@Jess: I like the way you think :)
If you’re an ecommerce company, and you’re using Google Analytics ecommerce tracking, then there should be a tab for ecommerce metrics at the top of the event report. Just click that tab and you’ll see revenue, per visit value, etc. for each keyword.
HOWEVER, you can not view the avg. event value, along with the revenue, in a single report. Those metrics do not mix.
Hello, First time I read you.
I have made a modification to your code to get host google.
First line :
if (document.referrer.match(/google\.com/gi) && document.referrer.match(/cd/gi))
To :
if (document.referrer.match(/google\.([a-zA-Z]{2,5})/gi) && document.referrer.match(/cd/gi))
After i create a new var
var moteur = myString.split(‘/’)[2];
And finally modify track event like this : _gaq.push([‘_trackEvent’, moteur, keyWord, p, rank, true]);
In google analytics i made a custom board to track some information :
https://www.google.com/analytics/web/permalink?uid=mPKMZ_rER4K2PmmX6lowxQ
Like this you can have each ranking by google.* (I’m french and .be, .lu are important.).
The JS with modification :
if (document.referrer.match(/google\.([a-zA-Z]{2,5})/gi) && document.referrer.match(/cd/gi)) {
var myString = document.referrer;
var r = myString.match(/cd=(.*?)&/);
var rank = parseInt(r[1]);
var kw = myString.match(/q=(.*?)&/);
var moteur = myString.split(‘/’)[2];
if (kw[1].length > 0) {
var keyWord = decodeURI(kw[1]);
} else {
keyWord = “(not provided)”;
}
var p = document.location.pathname;
_gaq.push([‘_trackEvent’, moteur, keyWord, p, rank, true]);
}
@cedric: Thanks for your addition. I have not tested the code but I like your approach. Thanks again for contributing.
@Justin
I have tried it on my site.
But I see the code in the footer, when i am previewing it live.
What could go wrong?
Unfortunately I can’t really help. That sounds like an issue with your CMS. If you get the code on your site it should work just fine. Sorry I can’t be of more help.
I was having the same problem with the code showing on the page too! I found that if I put before the code and after the code, then the code wasn’t visible on the page anymore. Being a newbie I’m not sure this is right – could someone confirm?
Does this work for all search engines?
@Coltrane: The code in my post will only work on Google.com. BUT some other folks have posted new versions in the comments that will track other Google domains (.au, .uk, etc.) I have not tested the code, but it looks good. Based on feedback over the next few weeks I’ll probably make some updates.
This is a great method because it helps you understand the breadth of your current rankings versus the limiting approach of loading up a ranking tool with specific keywords to track. With the not provided increasingly limiting value of branded/generic keyword analysis and etc; this is a great way to add value back into GA for tracking SEO success.
Thanks for sharing Justin! We have already started implementing for clients.
We’ll definitely have to try this out. Until someone created a Magic Decoder Ring for the ever-frustrating “(not provided)” we’ll take any scraps of data we can get.
@Hedid: That might be the best comment ever. Thank you!
Thats awesome. Should be default at the google ga code. Will build it in asap. :)
Hi Justin,
I had one question, since we are capturing ‘cd’ parameters to track rankings, does it mean that the local listings/ universal results will also be counted along with the organic listings?
If yes, is there a way to exclude such results and just get the organic listing?
Thank you to You & AJ Kohn for the new method.
@Yougender: Yes, every search, coming from a Google domain and containing the ‘cd; parameter will be tracked. I guess you could exclude the local listings/universal results if you can identify them via some query parameter in the referral URL. You’d need tweak the tracking code. Perhaps this is a feature for V2.
Hi Justin, Thanks for writing up this guide, it’s fantastic. It inspired me to write my own guide to event tracking (http://www.koozai.com/blog/analytics/the-complete-google-analytics-event-tracking-guide-plus-10-amazing-examples/) as there are so many reasons to use event tracking! I’ve included a link to this post from there as there was no point me trying to explain it myself :) I’m loving the data available with this, it’s much more flexible than using filters as I’ve done in the past.
Anna.
did Google stop serving part of the referral information. I get
document.referrer.match(/google\.com/gi) returning [“google.com”] and
document.referrer.match(/cd/gi) returns null in my console
Unfortunately, as Yougender pointed out, any type of keyword tracking using the “cd” parameter is going to include universal results. These can really skew the results!
For example, if there are 3 news listings on the first results page, and you appear as the last organic result on the page, you’re going to have rank = 13. If you get bumped one spot though, you’ll land as first result on the second page, but since there are no news listings there, you’ll appear as having rank = 11 (since the cd parameter starts at 11 on the second page, regardless of how many news/picture/local/sitelink results there are on the first page). So basically, even if you lost ranking by 1, in Analytics you’ll see it increased by 2.
This is even a bigger problem since some universal results are removed/added from time to time, further giving false increase/decreases in Analytics ranking.
I’ve been trying to find a workaround to remove universal results, but can’t seem to figure it out. Guess we’ll have to rely on GWT data for now…
when i google in Firefox and IE, it seems referrer dont’ have “cd=” , and for chrome, all searches are encrypted. this js can’t extract any ranking data from google
@Mike: You may want to check with AJ – but coverage with the CD parameter should be pretty good, that includes encrypted searches. In my data I see a search term of (not provided) and the ranking for the result. It’s not perfect, but I’ve been capturing ~ 50% of the queries.
This is great one. I tried this code but i am getting the Avg.value is 100 to 500 per day for lots of keywords. Please clarify to me.
@Vijay: That’s the average rank for your keywords. If things are working right, then it means that many of your keywords are long-tail keywords and appearing later in the search results.
Awesome, I tried it, it’s so useful & it works well. Thank you Justin & AJ.
I modified a little the script to prevent incomptibilities if you like:
(function (d) {
var myString = d.referrer,
r, kw, keyWord;
if (window._gaq && myString.match(/google\./gi) && myString.match(/cd/gi)) {
r = myString.match(/cd=(.*?)&/);
kw = myString.match(/q=(.*?)&/);
keyWord = (kw[1].length > 0) ? decodeURI(kw[1]) : “(not provided)”;
window._gaq.push([‘_trackEvent’, ‘RankTracker’, keyWord, d.location.pathname, parseInt(r[1], 10), true]);
}
}(window.document));
Mathias:
Looking to test your version of the code. How is it different from what the original does? I am also getting lots of javascript validation errors with our code, so not sure where its broken. thx.
Hi Victor, I just slightly modified the script to make it follow JS good practice so that there is less risk of incompatibility.
very inventive. I used to have a setup somewhat similar but this seems more elaborate. I used the custom variable feature provided in GA. The only good thing about that setup was that no code had to be written/changed for that. Will definitely give this method a try.
Hi Justin, first thanks for this guide, just awsome.
I want you advice beacuse tried to install on blogger and I got this Error:
Error analizing XML, line 903, column 47: The entity name must immediately follow the ‘&’ in the entity reference.site
Question: Doesn´t work on a blog site?
http://seoyanalytics.blogspot.com/
Thanks a lot,
Juan
@Juan: Thanks for the heads up. Unfortunately I’m not a Blogger expert, I use WordPress. But it seems like the code may needed to be encoded for Blogger to accept it.
Anyone else have any feedback for how this might work on Blogger?
Thanks for your kind answer Justin, FYI: is working just fine on mi site, http://www.adwordscolombia.net …that´s Google Colombia.
I got the itch nonetheless, if anyone knows about how to make it work in Blogspot/blogger an help would be most appreciated. Regards, Juan
First off, this is awesome. Thanks so much to you and AJ for figuring this out and sharing. Just to clarify, the code you provided – should that be placed inside of … tags just after the analytics script? Or should this be placed inside the closing tag of the analytics script? Thanks for any clarification.
@Nils: This is an arbitrary piece of JavaScript. So it needs to go in < script > tags. As long as it appears after the standard GA page tag you should be OK.
Hope that helps.
That’s a brilliant piece of thinking and a great article. Paid services like Web Position will hate seeing this kind of thing… Cheers for sharing!
I’m having some trouble being clear on where exactly the code should go also. Is this what it should look like?
@Robin: Make sure you add your Google Analytics account ID to the code, it’s the UA number. Then the code should go in the < head > section of your site. Hope that helps.
Hi,
Great article!
How do I paste the code on my website if I use yoast google analytics wordpress plugin ?
many thanks
@Faye: You want to make sure the code appears in the head. I added mine to my template. I’m not a WordPress guru but I went into my Genesis Theme settings and added it to the HEAD section of the site. Your implementation may be different based on your theme. Hope that helps.
i’ve used one of the versions posted in the comments for Google Italy and it works beautifully! I’m elated!
Thanks Justin :-)
@Justin : I notice that not all my google organic search keywords are showing up in my event tracking report for this – I am referring to the ones that actually do have a keyword value available. For example, on any one day, I see , say, 50 organic keywords from google specifically in my Traffic sources report. Then in my event tracking report for keyword tracking, I’d see 5. Looks like very few make it through. Its working but not all the time. Is that your experience as well?
btw – you mentioned a version 2 coming? Many thanks for your insights here ..
@Vistor: Thanks for the heads up. It should be a lot more than that. I have to do a bit more investigating, most people are getting more than that. The coverage of the ranking parameter should be on most Google sites, so the code should work.
Hi,
nice post, really great to see this.
Two questions,
1. Do you see the cost uploader feature being extended in such a way that we can upload 3rd party rank checking? The ability to choose average instead of some on upload would be amazing!
2. What does this offer that integrating with webmaster tools does not? I guess it’s easier to segment when wemaster tools metrics are unavaliable?
thanks,
Rachel
@Rachel: Cost-data upload runs on a new feature called Dimension Widening. This feature, when released, will let you import almost any type of data into Google Analytics. You basically specify a key (like campaign ID) and then upload data to link to that key. The benefit over Webmaster tools is that all of the dimensions that you upload via dimension widening become first-class dimensions. You can use them in custom reprots, segments, etc.
One more advantage over Google Webmaster Tools… it provides a way to track conversions. GWT does NOT track conversions.
@Rachel Keep in mind that while webmaster tools is good for some general trend insights the data is highly unreliable. The data tracked using this new GA ranking method has proven to be more reliable from what we have seen to date. Of course, it isn’t perfect as others have mentioned significant drawbacks based on local and universal search listings that can misrepresent the true ranking.
Thanks a lot! It’s great and very insightful ;) can’t wait to get the code version with image search traffic isolate !
this is what I am looking for.. firstly thanks for the share.. currently I am using yoast method to track rankings but this one is far superior..
I like your idea but sadly with https secure google searches it makes this idea useless. For those with smaller websites the amount of plain ol http referrers is too small to measure with any granularity. You might as well stick to traffic sources / organic which provides the same information without any extra code.
This technique is really intriguing. I’d be interested to hear from those who have had success with it.
We are having success with this technique. It can be very helpful at times to validate search ranking data and see fluctuations in rankings. Let me know if you have any specific questions and I will do what I can to provide more details.
@Ross
I know you mentioned that replacing the “(/google\.com/gi)” with “(/google\./gi)” will also show the localised version of google.
I would like to restrict it to only my local Google here in South Africa. Would I keep it as is or change the “/google\.com/gi” to “/google\.co\.za”
Thanks in advance
Great !! thank you !!!
Now we have a better way to see at what position we rank for !!
I can’t wait to use this code..
Will this script work the same in Universal Analytics as well or do i need to tweak something ?
@Nikitha: This script will not work with Universal Analytics. I’m trying to decide if I will update it for Universal. You – and a few others – have requested an update. Thanks for the note!