Google +1 Button SEO – Getting Bulk Counts with the hidden API

Pile of +1 Buttons Now that the Google +1 button is out the Social SEO battle will inevitably be stepped up a gear. We know the search engines are using social shares and likes to impact the rankings, and Google’s +1 button is their way of ensuring at least some of this data is directly in their hands.

So obviously, tracking this data is very important for SEOs, and both Facebook and Twitter have APIs for pulling in Likes and Tweets, but currently we are left without a public API for doing this with Google’s +1 button. With a little digging behind the scenes I managed to find the API they use for the button. So now us SEOs can use it to pull out the Google +1 counts for lists of URLs (if you are interested in the technical details then see the optional section below).

I’ve put together a public Google Spreadsheet which can do all of this automatically for you – you just need to enter a list of URLs and the spreadsheet will pull in the counts for you. To get started, open the spreadsheet (download it right here) and select “Make a copy” from the File menu (you’ll need to be logged into a Google account to do this). Enter the URLs in the the A column (ensuring you pay attention to trailing slashed and they include http:// at the start), and the counts will appear in column B. You should see something like this:

Google Spreadsheet showing Google +1 Counts

Technical Bits

If you want to write your own solution, you can rip the code from the spreadsheet. The URL for the service is:

https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ

It is a JSON-RPC setup, meaning you send a JSON formatted request and get a JSON formatted response. The request should be via POST in the following format:

  1. [{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"http://www.test.com","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]

The request will be returned like so:

  1. [{"result": { "kind": "pos#plusones", "id": "http://www.google.com/", "isSetByViewer": false, "metadata": {"type": "URL", "globalCounts": {"count": 3097.0} } } "id": "p"}]

Example PHP Code

If you want to implement this server side, here is some example PHP code to get you going:

  1.  
  2. <?php
  3.  
  4.  $url = "http://www.tomanthony.co.uk/";
  5.  
  6.  $ch = curl_init();  
  7.  curl_setopt($ch, CURLOPT_URL, "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ");
  8.  curl_setopt($ch, CURLOPT_POST, 1);
  9.  curl_setopt($ch, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
  10.  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  11.  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
  12.  
  13.    
  14.  $curl_results = curl_exec ($ch);
  15.  curl_close ($ch);
  16.  
  17.  $parsed_results = json_decode($curl_results, true);
  18.  
  19.  echo $parsed_results[0]['result']['metadata']['globalCounts']['count'];
  20.  
  21. ?>

There is an interactive demo here: Google +1 Button API demo.

Wrap Up

If you want to track social shares and likes and aren’t already setup with a Google Doc for the Twitter/Facebook parts you can head over to this post on Distilled which will help you get going. Combined with the above and you can build a complete system for tracking social search signals. Have fun!

Competitive Analysis in Under 60 Seconds Using Google Docs (on SEOmoz)

SERP reportFaced with a new client, and having established a list of keywords they need to target, you want to evaluate the competition to find out what sites are dominating the SERPs for these keywords. However… being an SEO you’re a busy guy (or gal), and you need it done right now. I’ve built a Google Docs tool to automagically do exactly that and this post will walk you through it.

Using SEOmoz’s Linkscape API with Google Docs

SEOmoz Linkscape API is an extremely powerful tool for SEOs, but SEOs often do not come from a development background, and might find the API inaccessible to them. Whilst I believe SEOs should learn to code somewhat, I know not everyone is from that school of thought. If you are unfamiliar with the API, then you can see the SEOmoz API wiki; we’re going to be looking at the URL Metrics API.

Luckily, a recent blog post from Ian Lurie details using Linkscape API with Google Spreadsheets. Ian’s post is great, and probably does exactly what you are looking for. What I post here is a modified version the code from his post, which I used to form the basis of a competitive analysis tool detailed in my recent SEOmoz post: Competitive Analysis in under 60 Seconds using Google Docs.

You can see the code in action in my example spreadsheet (you’ll need to copy if and add your SEOmoz API key), or take a peek here:

Continue reading

Google’s +1 vulnerable to clickjacking?

Google +1 logoThe internet and particularly the SEO community is abuzz from Google revealing there new +1 button yesterday. If you are unsure what this is all about then you could start by reading this introduction to +1 by Danny Sullivan over at Search Engine Land. If you are interested in reading more about the impact on SEO then you should start with Tom Critchlow’s excellent analysis on the rise of social SEO on the SEOmoz blog.

If you aren’t interested in any of that and just want to play with it already then log into your Google/Gmail account and head over to Google Experimental where you can turn the feature on if you’re not already seeing it. If you are in the UK you need to make sure you aren’t being redirect to Google.co.uk which doesn’t serve the buttons currently, you can start via Google.com/ig. If you are using IE7, an iPad or probably numerous other devices then you are out of luck for the moment. Though if you are using IE7 you probably have other problems to worry about. 😉

There is some great coverage of the +1 button already all over the internet. My post today focuses on the fact that it appears that the +1 button is vulnerable to clickjacking…

Continue reading

Link Building and Hugs

You can't outsource giving a shit. -Tom CritchlowThere are a tonne of write ups (and some great photos) about the Distilled Link Building event that took place on Friday, so I’ll keep this short and sweet: it rocked. There was a great mixture of high level strategy tips, with low level techniques to use.

To illustrate: Reddit is currently piling up the sand bags ready for the onslaught that could come when people follow one strategy given up by the venerable Russ Jones.

Every single speaker had me scribbling down notes as fast as I could manage, and day dreaming about how I could deploy some of their ideas. All the attendees seemed to be in a trance, and it was quite exciting to be there for this groundbreaking link building event.

If you are stateside and you can make it to New Orleans this week I think there are still tickets available for the next iteration of the event. I cannot recommend it enough; I love the SEO community because there is such a great culture of sharing knowledge but I was still surprised by the depth of the amazing tips that some of the speakers were giving away.

Rand Fishkin and Tom AnthonyAfter the main event, those who could withstand the urge to go and start trying out their new link building ideas right away headed over to a nearby pub/bowling place for some network, bowling and a few beers.

I met some great people there, and exchanged some cool ideas.

Lastly, if you’ve been over at the new SEOmoz Q&A building up a few mozPoints (damn you Egobait!) and weren’t sure if they’re worth the effort then I have news. No sooner did I complain to Rand that the promised ‘hug from Roger’ (SEOmoz’s mozBot) failed to arrive when I reached the requisite 50 mozPoints than he set upon me himself to make up for it. I could feel the SEO knowledge emanating from him… I think that’s what it was.

See you next year!