keerthi
keerthi

Reputation: 767

How to share content from our site to google plus

How to share content from our site to google plus

I tried it like this

<a href="javascript:void(0);" onclick="window.open('https://plus.google.com/share?url=<?php echo urlencode('http://example.com');?>&via=example', 'Share on Google Plus', 'width=600,height=400,left=450').focus();" >

Here I can not share content from my site. How it is possible with this? I want to share content (example: hello) to goggle plus with sharing capability

Upvotes: 0

Views: 870

Answers (2)

Samir Dash
Samir Dash

Reputation: 118

yes. You can paste a content from your app which you have to set as a default data.. https://developers.google.com/+/web/share/interactive#button_attr_calltoactionurl

Nothing much to do here..

Just create a google plus app on the developers section. Then Paste the below portions

<button
  class="g-interactivepost"
 data-contenturl="https://plus.google.com/pages/"
  data-contentdeeplinkid="/pages"
  data-clientid="xxxxx.apps.googleusercontent.com"
  data-cookiepolicy="single_host_origin"
  data-prefilltext="Engage your users today, create a Google+ page for your business."
  data-calltoactionlabel="CREATE"
  data-calltoactionurl="http://plus.google.com/pages/create"
  data-calltoactiondeeplinkid="/pages/create">
  Tell your friends
</button>

Then change the data- client id.. Now it will work as per your expectation. Enjoy :)

Upvotes: 2

Starx
Starx

Reputation: 79031

Its been some time since the Google has brought its share button. You can find this, on their developer's page. [Here]

Paste the generated code on your web page, then link of the page will be automatically received by the API.

Upvotes: 0

Related Questions