Google +1 button code

Tracking Google +1 button Interaction in Google Analytics

Tracking Google +1 button Interaction in Google Analytics

June 01st, 2011 – 111 Comments

[plus1]Today Google introduced the new +1 button, which I of course immediately implemented (see below and, on this specific post, on the right). It comes with an option for a callback function that you can use to track interaction with that button in Google Analytics. The implementation is pretty easy so let’s go ahead and explain it. First of all, you place the required script tag somewhere, preferably in the footer before the </body>:

<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>

Then you create your +1 button using Google’s creation tool. On this creation tool you click on “Advanced options” and then add plusone_vote as callback. You’ll get something like this:

Google +1 button code

And the code is like this:

<g:plusone size="tall" callback="plusone_vote"></g:plusone>

Last but not least, below the script tag for Google +1 we added above, you add this tiny bit of script. This function records the vote as an event in Google Analytics, and stores the state (“on” for a +1 vote, “off” for the removal off a vote):

<script type="text/javascript">
  function plusone_vote( obj ) {
    _gaq.push(['_trackEvent','plusone',obj.state]);
  }
</script>

Of course I haven’t been able to do anything with the results from this yet, but it would be cool to see which kind of traffic uses +1 buttons, and whether a lot of +1’s correlate with a lot of search traffic afterwards.

Update: might be fun to show you that this post was ranking quite fast with a nice +1 underlining:
google plus one google analytics


111 Responses to Tracking Google +1 button Interaction in Google Analytics

  1. Peter
    By Peter on 1 June, 2011

    Where does the clicks go ?

    Twitter clicks to my account.
    Facebook to my account.
    +1 where ? who can see that ? my google buzz followers ?

  2. Anders
    By Anders on 1 June, 2011

    Thanks,

    wondered how i’d be able to track this.

  3. Alex
    By Alex on 1 June, 2011

    Are you able to see in Analytics any new data which is useful that you were not able to see before? I think people are hitting button-overload.

    • Joost de Valk
      By Joost de Valk on 1 June, 2011

      It’ll be curious to see how many people will actually use it, of course, but I have to think that it’s relevant especially for my readership.

      • Ricky
        By Ricky on 2 June, 2011

        I just implemented it in the sidebar with a text widget, to see what happens. Still waiting to see if i want to include it inside every single post, since it has to be done manually.

      • Robert Went
        By Robert Went on 4 June, 2011

        Oh Yeah!
        You are the first site to publish this and everyone is creaming over it. Twitter trend of the month so far!
        Love your wordpress tips (I’m a joomla man) and you also helped me out alot with a massive magento project.
        Keep up the good work. You are not unknown in many comunities!
        Rob

      • Martin
        By Martin on 20 June, 2011

        Good reading, though i agree that its relevant to the readers at this site, i cant help wondering how many of the ordinary google users that will use it, i think one should be very passionated about the site if they are going to give +1’s.

  4. Ivan Brezak Brkan
    By Ivan Brezak Brkan on 1 June, 2011

    Could you be any faster? :)) Great and useful reaction to the +1 release…

  5. Mike Smith
    By Mike Smith on 1 June, 2011

    I just added the +1 button to my blog and am happy to know we’re able to track a bit of it’s use like this. My thought is that the +1 use might help dictate search rankings a bit more than Google is letting on, seeing as how they’re pushing for “quality content” results now, this should give them an inside view as to what people find valuable.

    • Kriti
      By Kriti on 2 June, 2011

      A bit unlikely as if it can affect the search results of the blog, then what about those blogs which havnt installed the feature yet?? but if you are talking about the +1 feature in the search results itself, it could be possible.

  6. André Scholten
    By André Scholten on 1 June, 2011

    Nice, implemented it right away.

    • André Scholten
      By André Scholten on 1 June, 2011

      Added some tweaks though: change the URL of the plusone.js to https because the http version redirects to it. And I loaded it asynchronous at the end of the body.

  7. Ipstenu
    By Ipstenu on 1 June, 2011

    I’m finding it’s pretty hit or miss if it works. It worked for me here, but on other sites, I get a nice red ! to tell me it failed. No explanations, and a java void(0) error. Still, it should be interesting to see how this pans out.

    • Taeke
      By Taeke on 2 June, 2011

      Same here, just added it to some sites and when testing I get a red icon with warning sign. Just +1 this site and all works well, any clue Joost?

  8. Martijn van Vreeden
    By Martijn van Vreeden on 1 June, 2011

    Thanks for sharing! This must be a new speed record :) I implemented it immediately. I’m curious to see how many people will use the new button. We’re all so used to tweets and likes…

  9. Brad
    By Brad on 1 June, 2011

    Will this be added to your WordPress SEO plugin soon? =)

    • Brad
      By Brad on 1 June, 2011

      I dont know why I said your SEO plugin. A better place for it would be in the settings for your GA plugin. Or maybe a new plugin.

  10. Ethan
    By Ethan on 1 June, 2011

    Great post! I just added the +1 button and then realized I’d love to track it w/ Analytics. Did the search you mentioned above and got it added. Thanks.

    I’m curious to see how SERPs are affected. The FAQ states increased crawling and “a useful signal to Google when determining the relevance of your page to a user’s query”. One can hope :)

  11. Erwin
    By Erwin on 1 June, 2011

    We also added the new vote button of google. Let’s see what kind of results this in give in the SERPs. Btw i don’t see the results like your screenshot in google. Used the google.com search.

  12. Michael Aulia @CravingTech.com
    By Michael Aulia @CravingTech.com on 2 June, 2011

    Just added it too but mine is still too tiny. Might have to tweak around to make it bigger and more noticeable. I still like the Facebook Like on my posts. Still skeptical how long will this +1 last

  13. Joe from MWD
    By Joe from MWD on 2 June, 2011

    How or what plugin are you using to add your share links ?Or you just added it to the theme it self

  14. nokz
    By nokz on 2 June, 2011

    i added mine too in my blog. :)

  15. Michele
    By Michele on 2 June, 2011

    Great post!! Thank you so much :)

  16. NIkhil Kulshrestha
    By NIkhil Kulshrestha on 2 June, 2011

    I also added it today and waiting for the response it going to send. But where these responses could be seen, any idea? want to track visitors on my bog as GA. Is it have any such option. Regarding the size and place yes Google need to think again about it. It could miss by most of the visitor. Best place could be “top right of the heading” and just end of the post.

  17. Piet
    By Piet on 2 June, 2011

    Do I mis somethink? I don’t see the +1 button on this page. On Google I read hoe have to be logged in on a Google account. So I am logged in but stil no button. May be because I workshop on the iPad. So how Does the button works?

  18. NIkhil Kulshrestha
    By NIkhil Kulshrestha on 2 June, 2011

    Hey just notice end of the posts of your blogs. It will present with all social bookmarking sites(twitter, facebook,+1) symbol.

  19. Jim Maidis
    By Jim Maidis on 2 June, 2011

    Thanks for your information about the code for analytics Joost, really curious to see if people use it in the future.

    I think it’a nice move for google to reach the interactivity of facebook like buttons.

  20. Petter El Fakiri
    By Petter El Fakiri on 2 June, 2011

    Could this simple script be used on other buttons aswell then? as for fb, linkedin and other share-buttons

  21. Markus Jalmerot
    By Markus Jalmerot on 2 June, 2011

    Thanks for some good advise as always ;)

  22. Rick
    By Rick on 2 June, 2011

    I’m about to added this to my blog as well.

  23. Glen Craig
    By Glen Craig on 2 June, 2011

    Where in Analytics do you see the +1 stats? Thanks!

    • Jordan Louis
      By Jordan Louis on 2 June, 2011

      You’ll see the +1 stats collect under Content -> Event Tracking in the Google Analytics interface.

  24. William Rock
    By William Rock on 2 June, 2011

    Thx, I cannot wait to see how this takes effect. As Marketers we have known about this update coming from way back but most of the world has no clue on what this is and what to do with it.. So I am interested in how Google will get people to use this addition.

  25. Warren Bowman
    By Warren Bowman on 2 June, 2011

    Hello

    Am I the only one when I click to create the button I get a redirect loop and can’t access the page. I’ve been having this problem since yesterday and tried in 3 different browsers.

  26. Mark
    By Mark on 2 June, 2011

    Hi,

    It’s going nicely as far as I can see. Button seems to be clicked on a lot.

    I’m hoping you get some useful information on GA from this. Thanks for testing this for us. And of course, would love to see this implemented in the GA plugin, lol. By the way, isn’t that integrated right into your WordPress SEO plugin?

    Anyway, thanks again and will be looking for more info here…

  27. Les Faber
    By Les Faber on 2 June, 2011

    Interesting that one needs to have a Google Profile to use the button. And even more interesting is that we use Google Apps (free) and one cannot create a Google Profile with it. So that means I have to log out of my business G-mail and log into my personal G-Mail account (where I do have a Google Profile) to “Plus 1” you Yoast. You’re a good guy…. and I love your Plugins & Blog posts…. but….

    Seems like Google didn’t think this one through completely….

    So the +1 feature is really about telling Bloggers etc about how many people who use a certain subset of Google products like what has been published. And to heck with anyone else?

    Or maybe I am thinking too much?

    Sidenote: The +1 feature does not seem to be “live” on Google.ca

    As usual, you do a thorough job Yoast – great post as usual (despite my negative comments towards Google.

  28. Dev Basu
    By Dev Basu on 2 June, 2011

    Thanks for the tutorial Joost. We’re going to implement this on a couple of client sites in a non-competitive vertical where we’re pretty sure no one else is using +1 and run some tests to see its effect on the SERPs.

  29. Chris
    By Chris on 2 June, 2011

    Thanks to you helpful tips I have added +1 with no problem! Will it be showing up under events in Google Analytics?

  30. Erik
    By Erik on 2 June, 2011

    Great Post! Tx – Any input as to when other language versions might be available (I am looking for Dutch) – Thanks – Erik

  31. Pierre DeBois
    By Pierre DeBois on 2 June, 2011

    Nice explanation. I think between the +1 / analytics link and tracking with URL for QR codes/within URL shorteners, GA users will be better able to see how far their online exposure goes. If anything it will put pressure on SEO and social media managers to track more thoroughly. Thanks for sharing this.

  32. Elio
    By Elio on 2 June, 2011

    Hi Joost, I’ve implemented your code in the +1 plugin for WordPress released yesterday, with all due credits of course :)
    http://ilovecolors.com.ar/wordpress-plugin-add-google-1/

  33. Jonathan
    By Jonathan on 2 June, 2011

    Thanks for this update, Joost. May I ask how you create the social media buttons bar at the end of your posts?

  34. Keesjan Deelstra
    By Keesjan Deelstra on 3 June, 2011

    @Joost great script hack. I think Google analytics and webmastertools will at this tracker soon by default?

    Anyway maybe also interesting for your readers: http://www.seoeffect.com/blog/Effects-of-the-Google-%2B1-button-researched-download-the-whitepaper/ A free research paper about the +1 button and its effect on visbility and CTR.

  35. James
    By James on 3 June, 2011

    @Joost. Can the same thing be done for the Facebook like button, by adding callback=”like_vote” etc to the fb:like code?

  36. @Mario_Luan
    By @Mario_Luan on 3 June, 2011

    Oh! That’s pretty nice. Thanks!

  37. Sreejesh @techgyo
    By Sreejesh @techgyo on 3 June, 2011

    Cool! I just added it in my blog, they’ve made it look simple. It already started bringing traffic to this this page, making it to 1st in SERP. Is that cos of the number of +1s this page have received?

  38. Google +1 WordPres
    By Google +1 WordPres on 3 June, 2011

    Here is a WP plugin to ad the +1 button: add +1 to wordpress

    • Fr4nk
      By Fr4nk on 3 June, 2011

      Thank you for the plugin.
      Must say soon we’ll have full pages of like,+1,retweet etc. buttons… :)

  39. maxmas
    By maxmas on 3 June, 2011

    Nice button.. I’ll try on my blog.

  40. Dave Durbin
    By Dave Durbin on 3 June, 2011

    Always timely. We’ve seen dramatic SERP visibility increase but only for those Google deems in our “Social Circle” and only when the searcher is signed in. This Is Google’s play to make everyone log in to gather demographic info and search behavior I’m sure.

  41. E-Siber
    By E-Siber on 3 June, 2011

    Hello from Turkey,

    This is awesome. And i have mentioned about your post in my website: http://www.e-siber.com/google/google-1-butonu-tiklamalarini-google-analytics-ile-takip-edin/ with your refer url.

    Thanks

  42. Simon
    By Simon on 3 June, 2011

    Did implement the plugin, but does anyone know how much relevance it has to the serps?

  43. Paul Olyslager
    By Paul Olyslager on 3 June, 2011

    It seems that the +1 button is not visible in IE7.

  44. Chris
    By Chris on 3 June, 2011

    Is it possible to use jQuery or just plain ol javascript to append the callback=”function” into the gplusone html?

  45. Joe from MWD
    By Joe from MWD on 3 June, 2011

    Thanks to yoast I added the button but also added some additional info as to where to place it in wordpress and blogger, thought you might be interested:
    http://www.mwd.com/2011/06/google-1-button-wordpress-blogger-embed/

  46. Allison
    By Allison on 3 June, 2011

    I had been using your Analytics plugin for a while, but about three weeks ago my URLs began showing up as doubled in Analytics [http://allisondduncan.com/http://allisondduncan.com OR http://whatever/http://allisondduncan.com%5D.

    I just recently installed the +1 button so am excited about using your plugin to track this, but with my URLs getting all screwed up I’ve been disabling all plugins to try and find out what’s going on.

    Any chance you’ve encountered this before and can make a suggestion? So far the WP.org site hasn’t responded.

    Thanks,

    Allison
    The Nerd Connection

  47. Brandon
    By Brandon on 3 June, 2011

    Doesn’t Google say we can’t do this?

    http://www.google.com/webmasters/+1/button/policy.html

    • James
      By James on 4 June, 2011

      Not that I can see. Which line are you referring to?

  48. glenis
    By glenis on 4 June, 2011

    Needless to say someone will be out with a plugin that will add the plusone to your site and ensure it gets clicked from 15,000 randomly distributed ips. In the end it will be the ‘real’ people who loose.

    I won’t bother I’m not fond of Google tracking what I do, …. or my government, tax department, credit card company, bank, …. I’m paranoid !! :)

  49. enursa
    By enursa on 4 June, 2011

    Great. I have installed Google +1, but not for the analytic. I think i must add it now.

  50. Steve
    By Steve on 5 June, 2011

    I have followed the instructions but cannot see the button on my site. Does this work in the UK ? I cant understand why I can’t see the button.

  51. Ed Harris
    By Ed Harris on 5 June, 2011

    Wow Joost, this is incredible, I know I am late but you released this only few hours after official Google post.

    I’ll implement this on my blog asap and will see results soon.

  52. brij
    By brij on 8 June, 2011

    Hi, Thanks for this information.
    I think this +1 mark will help the users of google search engine to now get the right content they are looking for. Otherwise it is very difficult to find the right content on google.
    Regards

  53. hammock
    By hammock on 8 June, 2011

    Google turns into a social network ((

  54. Josh
    By Josh on 9 June, 2011

    IMHO, the +1 button will fade into obscurity long before it ever gets a chance to be useful. I would like to think otherwise but Google’s trying to hard to elbow into Facebook territory and it’s just not the same.

  55. Top 10 English songs
    By Top 10 English songs on 10 June, 2011

    Really Informative, Thumbs Up!!

  56. nokz
    By nokz on 22 June, 2011

    im starting a new blog. is it ok if i added +1 in my new blog? thank you
    http://blogs-life.blogspot.com


Check out our must read articles about Analytics