How To Add Google Share Button to Website

0
SHARES

Google launched Google Share Button which allows sharing contents with friends. In this post let us see how we can configure and add this new share button to our site.

Google Share Button

Step 1: Visit Google Share Button Page
In order to configure google share button visit the plugin page. Select the design from the given options.

  • annotation: bubble-horizontal, bubble-vertical, inline
  • size: Small, Medium, Large
  • Language

Google Share Button Configuration

One can configure more if needed by selecting ‘Advanced Options’.

Step 2: Get the code
Copy the code shown on right and paste it on your site to show the google share button. The code looks similar to what is shown below.

<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share"></div>

<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
  (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  })();
</script>

If you have installed google plus one button, then you dont have to add the javascript portion. You need to add only the div tag.

Tags:

About Joby Joseph

Author of jobyj.in. I do a lot of research on web, APIs and social networks. Codes are mainly tried on PHP, jQuery, MySQL. Please support this blog by your facebook likes, twitter follow and RSS Subscribtion. Read more Google+