Specify image when sharing from Google +1 button

hyperrjas picture hyperrjas · Nov 9, 2012 · Viewed 14.4k times · Source

In this link, I have learned to specify a URL for the Google +1 button.

specify custom url to gplus one button.

Can I also specify a specific image?

Edited

I don't need to change the Google plus button gif or the background of the Google plus button. I need specify the image that a user want to share in social network.

Is possible?

Answer

BrettJ picture BrettJ · Nov 9, 2012

Yes this is possible.

What you mean is that you want to specify an image that will show up in the snippet that is generated by sharing on Google+. The +1 button does two things: 1) It adds a +1 to the count when clicked, and 2) optionally it allows a user to share your URL to Google+ and comment on it.

What you're asking about is the second part of that interaction and is documented at https://developers.google.com/+/plugins/snippet/

That page has a tool that can help you generate the HTML you'd need to insert into your page. You can also choose from three different methods of specifying the snippet information.

An example using schema.org markup:

<!-- Update your html tag to include the itemscope and itemtype attributes. -->
<html itemscope itemtype="http://schema.org/Article">

<!-- Add the following three tags inside head. -->
<meta itemprop="name" content="My Cool Article">
<meta itemprop="description" content="This is the greatest site ever">
<meta itemprop="image" content="http://example.com/mycoolimage.png">