Home ▸ Analytics ▸ Tracking Google +1 button Interaction in Google Analytics
Tracking Google +1 button Interaction in Google Analytics
1 June, 2011 by Joost de Valk
[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
:
< 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:
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):
1 | < script type = "text/javascript" > |
2 | function plusone_vote( obj ) { |
3 | _gaq.push(['_trackEvent','plusone',obj.state]); |
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:
No comments: