Paul's thoughts

Tracking Google +1 in Google Analytics

Paul is an SEO Manager at Epiphany, who takes a very analytical but creative approach to SEO. He has been working in digital for over six years. Outside of work, Paul is an accomplished magician and enjoys a good game of paintball!

Back to contents page

Earlier this month, Google launched the next phase of its +1 buttons, allowing you to embed +1 buttons on your own websites. These +1 buttons look and act similar to Twitter and Facebook buttons do currently, but it is yet to be seen if the Google +1 button will be as wildly adopted.

However if you do wish to use the +1 button on your website, it is handy to be able to track how users interact with it in Google Analytics.

Step 1: Creating the Google +1 button

You first need to create a Google +1 button: http://www.google.com/webmasters/+1/button/index.html

Here you can complete the basics that include choosing a button size and what language the button should use.

Step 2: Generating the Google Analytics callback

Once you have done the basics, you now need to click on ‘Advanced options’ that will reveal some new fields.

One of these advanced fields is called ‘JS Callback function.’ This field should be filled in with a unique term such as ‘plusone_vote’ as shown in the image below.

Step 3: The Google +1 code

Once completed you will then be given the code to use on your website to embed the Google +1 button. The code, to be placed either in the <head> of your site or just before the closing <body> tag, should look something like this:

<script type=”text/javascript” src=”http://apis.google.com/js/plusone.js”>
{lang: ‘en-GB’}
</script>

And the code to be placed wherever you want a Google +1 button to appear should look like this:

<g:plusone callback=”plusone_vote”></g:plusone>

Step 4: Google Analytics tracking code for the +1 button

To tell Google Analytics to track the activity of the +1 button, the following event tracking code needs to be added:

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

This code can be included with the previous generated code to be placed either in the <head> of your site or just before the closing <body> tag.

Once all of the above code has been placed on your website correctly, you will then be able to track how users interact with your +1 buttons as unique events within Google Analytics.

Any comments or questions are welcome either on here or Twitter. Catch me at @PG_Martin.

6 Responses to “Tracking Google +1 in Google Analytics”

  1. shishank says:

    Thanks for the article. But I am wondering what is the point of capturing unique events for +1?

    Shishank

  2. Nathan Jackson says:

    Great article, will be implementing throughout our +1 buttons.

    @shishank – The point in capturing +1 clicks is that you can then observe, segment and analyse the +1′s.

    Example: You could create a custom segment of people who +1 your site to see if they have a better on site conversion rate rather than other visitors.

    Example: You can see what rate your +1′s are growing on and on what type of content. You’d then be able to optimise for that.

  3. Grey Tip says:

    Thanks for the article. But I think the +1 button will work only when we are logged into our google account. Also can it be used by users outside of our social networks

  4. Paul says:

    @shishank

    Nathan answered that pretty well.

    Any insight you can get into how visitors are interacting with your site and your content, the better you can target them.

    Once tagged up correctly, you will be able to segment traffic to discover what type of content is working best for you. You will also be able to see if there are any channels that are consistently driving traffic that end up using the +1 buttons. If there are, then you can put more of your time targeting these sources, whether they be particular keywords and particular referring sites, to maximise on your traffic.

    It’s all about finding out who your audience is and delivering the goods to meet their requirements, and seeing how people interact with your content allows you to do this.

  5. Paul says:

    @GreyTip

    Like all social media buttons, you have to have an account to interact with it. With a Twitter button you need a Twitter account to use it, the same goes for Facebook, StumbleUpon, Digg, etc, and the Google +1 button is no exception.

    I am unsure as to what you mean when you ask “can it be used by users outside of our social networks”.

    If you mean can it be used by someone without a Google account then the answer is no, but for the same reason you can’t use a Tweet button without having a Twitter account.

  6. alex says:

    when adding Google Analytics code for tracking Google +1 im getting XML error : Open quote is expected for attribute “{1}” associated with an element type “type”.

    how to fix it ?

    thanks in advance

Leave a Reply