Chapter 2. Social Plugins

In the introduction you used the API Explorer to fetch your public profile. If the REST API is the core of the platform, the plugins are portals into Google+ from your web presence. This chapter explores these social plugins.

Social plugins are snippets of JavaScript code and HTML markup. They can be easily added to existing web pages and applications with only a few lines of code. They are also highly configurable.

A great way to learn the social plugins is to use them. You will add them to a blog called Baking Disasters. Baking Disasters consists of a static HTML index page and two entry pages that describe a couple of particularly disastrous baking attempts. You can see the initial version of the blog here: http://bakingdisasters.com/social-blog/initial/. The entry pages are a great place to experiment with the +1 button, and the index is an ideal candidate for the Google+ badge.

The +1 Button

Before there was Google+ there was the +1 button. Announced at Google I/O in 2011, this feature predates every other component of the Google+ platform. It provides a one-click interface for your users to publicly identify their favorite content. Once users have +1’d a page, they have the option to share it on Google+.

From your user’s perspective the +1 button is quite simple. They see your page, and since your content makes their eyes light up in excitement, they click the +1 button.

Figure 2-1 shows what happens next. The button turns red and their icon is added to ...

Get Developing with Google+ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.