Google Plus One button for Magento Products

created July 1, 2011, last updated July 26, 2011.

.
closeThis post was last updated 6 years 2 months 21 days ago, some of the information contained here may no longer be actual and any referenced software versions may have been updated!

Google Plus one Button for Magento

Google launched their Plus (+) range of products this week, Google + integrates existing products from Google along with some new social products into a new “social networking” service. Obviously Google want to challenge Facebook as a new social networking hub. While Facebook already have a huge user base, it is nothing compared with the number of users interacting with Google on a daily basis.

Interestingly, as Facebook attempts to assimilate the Internet into its own social networking open graph database populated with millions of people, Google , who already have the Internet indexed and cached in its huge databases now want to pull in the millions of people to create a social networking environment built around existing, new products and of course their number one business their search engine.

Enter the Plus One Button

The Google plus one button is to Google searches what the Facebook like button is to web content. Google says “The +1 button is shorthand for “this is pretty cool” or “you should check this out.””. When you or someone in your Google social circle “plus one” something by clicking the plus one button on a site, this information will be used by Google to manipulate/improve Google search results so that when you search for something you will be able to see for example if your friends have already recommended the product returned in the search. If your best buddy likes it, it must be good right? Whether its “pretty cool” or not lets wait and see, no doubt Google Plus will be THE next big thing. The plus one button is a clever way for Google to rewarding good web content and personalise search results, as (in theory) only humans will be able to “Plus One” something.

I am still getting my head around Google plus one and all of its implications but needless to say if there is a new social media marketing opportunity out there, especially one so tightly integrated with Google search then we need to take advantage of it and enable plus one buttons for our Magento products. Content with a large amount of +1s will get higher rankings in Google’s organic search results, create more visibility for your products and drive more traffic to your site. Google says “Think of the +1 button as a way for fans of your business to recommend what you offer, for all their friends and contacts to see. By helping searchers see more personal, relevant ads, we believe you’ll see more qualified traffic.”

Here is a 5 minute fix to add the plus one button to all Magento product pages.

Adding Plus One

For Magento 1.4+ stores:

We can place the Google plus one button next to our Facebook Like button with a few lines of code. Locate view.phtml in your theme, it will be located in the default/template/catalog/product folder of your theme.

<!-- Google Plus One Button BEGIN -->
<div id="google-plusone">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{"parsetags": "explicit"},
{"lang": "<?php echo $this->__('en-GB') ?>"}
</script>
<g:plusone size="medium" count="false" href="<?php echo trim(Mage::registry('current_product')->getProductUrl()) ?>"</g:plusone>
</div>
<script type="text/javascript">
gapi.plusone.go("google-plusone");
</script>
<!-- Google Plus One Button END -->

If you already have implemented a Facebook Like button, insert the following code below the existing code You can also position the google-plusone DIV wherever you would like the button to appear on the page with CSS.

To translate the locale code correctly add a line to your themes locale file and refresh your cache. For example for a German language store use

“en-GB”,”de”

Google Plus One Button for Magento
Google Plus One Button for Magento

For Magento 1.4+ make sure you have canonical URLs enabled in admin (see my Facebook Like button post for more info), we have specifed the URL in the Google API code to ensure Google uses the Magento enabled canonical URL. They say that the code will default to look for the canonical tag but better to be safe than sorry – in my tests it was not always used. The size and appearance of the button can be modified by changing the size and count options. See the Google documentation for more details.

Further Reading

http://en.wikipedia.org/wiki/Google%2B

http://googleblog.blogspot.com/2011/06/introducing-google-project-real-life.html

http://www.ibtimes.com/articles/172678/20110701/google-plus-facebook-killer-google-zynga-android-developers-facebook-losing-users-google-plus-next-b.htm

http://www.aaronpeters.nl/blog/google-plus1-button-performance-review

Comments

  1. john says:

    the last part does not work

    <g:plusone size="medium" count="false" href="getProductUrl()) ?>

    gapi.plusone.go(“google-plusone”);

    can not be pasted like that in view.phtml

    it messes up everything. please fix this 🙂

    • PAJ says:

      WordPress seems to do strange things to the tabs in the code pasted here which was causing the problem. Ive also moved everything into view.phtml for simplicity. Should work now.

  2. supriya says:

    when i click on google plus button after finish loading the count is showing zero with error icon ….
    so pls give me some soln for that