Home » Google » Currently Reading:

How to Share on Google+ from any website

August 9, 2011 Google 71 Comments Guestpost

This is a guest post from Alex Moss. He is a Partner at Pleer, Head of SEO at Banc Media and develops WordPress plugins. He found a way to share to Google+ from an external site, similar to the tweet button, and wanted to share it with SoS readers…

The Problem

Since Google+ launched, I have been asked a few times about whether there is some WordPress plugin or code to allow people to share a URL to Google+ from outside Google+ itself, in the same way a tweet, like or +1 button behaves. In short, there isn’t one. I don’t understand why this is, because as an SEO I’d want to make sure this was available immediately or at least used the +1 button somehow to add functionality to share the +1′d URL within Google+ for all/your circles to see.

The Solution

At the moment there’s still nothing official available that will let you do this, however, I realised that I could use the share URL from the mobile site and manipulate it to behave how I want.

Step 1: Get a Good “share” button image

I modified the wide +1 button and changed the text to “share”. I made both the grey and blue versions of it below:

plus How to Share on Google+ from any website

plus blue How to Share on Google+ from any website

Step 2: Grab the Code

Here’s some sample code:

<a href="https://m.google.com/app/plus/x/?v=compose&content=INSERT_MESSAGE_HERE_WITH_URL_IF_YOU_WANT" onclick="window.open('https://m.google.com/app/plus/x/?v=compose&content=INSERT_MESSAGE_HERE_WITH_URL_IF_YOU_WANT','gplusshare','width=450,height=300,left='+(screen.availWidth/2-225)+',top='+(screen.availHeight/2-150)+'');return false;"><img src="http://path.to/plus.png" alt="Share on Google+" width="55" height="22" /></a>

The URL linked to contains the parameter content. This parameter will automatically generate as the post when the widow opens. I have also added 2 things into the <A> tag:

  1. rel=”nofollow”
  2. The JS window.open() function to open the window as a pop in the center of the screen. To find a tidier version of the center of the screen JS, click here.

Here’s a working example of the button, sharing this article. Note that this will open a new window but will ignore the window.open() command:

plus How to Share on Google+ from any website

Optional Step 2.5: Insert into WordPress

WordPress is awesome, but you knew that already. WordPress here will be your friend by choosing all the 3 parameters automatically. I can edit the code slightly from Step 2 and I end up with this:

<a href="https://m.google.com/app/plus/x/?v=compose&content=<?php the_title(); ?> - <?php the_permalink(); ?>" onclick="window.open('https://m.google.com/app/plus/x/?v=compose&content=<?php the_title(); ?> - <?php the_permalink(); ?>','gplusshare','width=450,height=300,left='+(screen.availWidth/2-225)+',top='+(screen.availHeight/2-150)+'');return false;"><img src="http://path.to/plus.png" width="55" height="22" alt="Share <?php the_title(); ?> on Google+" title="Share <?php the_title(); ?> on Google+"></a>

NOTE: Insert this within your theme directly, not a post or page. For some reason I have noticed that WordPress removes the window.open command when inserted within a post/page.

The Limitations:

There are 3 limitations to this:

  1. The popup doesn’t look pretty, but that can be designed around if you want. I just white labelled it for you icon wink How to Share on Google+ from any website
  2. You can’t choose individuals to share with, but you can choose all circles and the general public.
  3. The shared URL doesn’t get optimised/embedded into the post as you would when sharing a URL the traditional way.

The last point is a shame, but I guess if you really want the feature on your site it’s worth breaking one egg.

Et voila!

Have fun! I will be making a WordPress plugin for this soon enough…

Editors note: Alex was kind enough to implement this right away in our sharebar on the left, so you can start sharing the posts from State of Search to your Google Plus RIGHT NOW! icon smile How to Share on Google+ from any website

More posts about Google Plus

 How to Share on Google+ from any website

Author: Guestpost

This post was written by a guestposter who is not a regular contributor to State of Search. Find more guestposts here and see all the other regular State of Search bloggers here. Opinions expressed in the article are those of the guest blogger and not necessarily those of State of Search.
Please share if you think others would benefit


Related posts:

  1. Google Plus One Button Shows Who Plus One-d a Page
  2. Google Adjusts +1 button: Now You Can Share on Plus from the Button
  3. Four Ways to Optimise Social Sharing on Your Website
  4. +1 Button is coming to Europe, but might slow your site down
  5. Google +1 Button is here, Get your Data to Google!

Want to keep informed on what goes on in the world of Search and Social and here on State of Search? Subscribe to our newsletter now!

Currently there are "71 comments" on this Article:

  1. Tad Chef says:

    Great idea but a potential privacy hazard as clicking the button requires the following:
    “By tapping ‘Accept’, you agree that Google will use your location in this product and accept the Mobile Terms of Service.”

  2. Pretty cool… Thanks for sharing your share buttons!

  3. [...] plugin or code allowing people to share a URL to Google+ from outside of Google+. “… …How to Share on Google+ from any websiteState of Searchall 2 news [...]

  4. [...] plugin or code allowing people to share a URL to Google+ from outside of Google+. “… …How to Share on Google+ from any websiteState of Searchall 2 news [...]

  5. [...] “…As an SEO I’d want to make sure this was available immediately or at least used the +1 button somehow to add functionality to share the +1′d URL within Google+ for all/your circles to see,” Moss wrote in a guest post on State of Search.  [...]

  6. Annelies says:

    Thanks! Will put it on my website. Would love it though if you could somehow program the familiar balloon with # times shared, above or aside the button. More coherent with the rest of my buttons ;-) .

    • Alex Moss says:

      At the moment there’s no way of having a counter to illustrate the number of shares. However, it’s not impossible to create a counter for the number of times the button is clicked – not very accurate though!

  7. Theo says:

    Smart piece of code, thanks for sharing it!

  8. [...] How to Share on Google+ from any website, State of Search [...]

  9. Quora says:

    Is there a Google+ share URL that can have a URL appended to its query string?…

    Just found a workaround: stateofsearch.com/share-on-google-plus-any-website/ Though it only displays the mobile interface, it still works. [code]https://m.google.com/app/plus/x/?v=compose&content=[TEXT_TO_SHARE_HERE][/code]…

  10. Ian MacGregor says:

    Requires my Google account password even though I’m logged into Google+ and Gmail in other tabs. Would like something that doesn’t require me to input my google account password because there’s no way I’d ask anyone to use this as it is.

  11. Divya Patel says:

    Great tip!

    I just shared your post on my Google+ account, and can already see a multitude of ways that it can be used within the online marketing space.

    Would love to hear everyone’s thoughts on how we can start better utilizing Google+ for marketing. The share button is a step in the right direction, but i don’t think everyone has Alex’s mind to manipulate the code and create alternate functionalities.

    http://www.GooglePlusForums.com has started listing tip and tricks, would love to get feedback.

  12. [...] Bei stateofsearch gibt es neben zwei Share-Buttons auch entsprechende Codeschnipsel. Ich habe hier testweise mal zwei Varianten mit folgendem Code eingebunden, welche funktionstüchtig sind: [...]

  13. [...] code voor de share-button is terug te vinden op de StateofSearch blog. Mensen die niet zo handig zijn met code moeten nog even afwachten. Alex Moss is namelijk een [...]

  14. [...] knop om direct je website of content op Google+ te delen. Hier bedacht Alex Moss wat op en schreef op StateOfSearch over hoe je een zelfgemaakte “Deel op Google+” knop op je site kunt [...]

  15. [...] ovu novu značajku na vašu web stranicu ili da bi je dodali na WordPress teme, možete pronaći ovdje. Relevantni naslovi:Novi Google +1 gumb od danas dostupan za implementiranje na web [...]

  16. [...] Moss hat eine simple Möglichkeit aufgezeigt, mittels eines simplen Buttons (oder Links) Beiträge aus jeder beliebigen WebSite heraus bei [...]

  17. [...] normale Webseiten, die für ihre Webseite keine WordPress Software benutzen, gibt es hier bei StateOfSearch. Scheinbar lässt sich der Share Button bislang nicht in einzelnen WordPress Posts, sondern nur [...]

  18. Andrew says:

    WHY IS ALL THE CODE IN CAPS?

  19. Dan says:

    How do I install this into my sharebar?

    I tried entering the code but it doesn’t work.

  20. [...] to their main Google+ timeline from outside of it. Alex Moss has been kind enough to provide a comprehensive guide on how to implement such a feature for WordPress (or other types of) websites.  As you probably can tell, we are using Sharebar for WordPress to [...]

  21. SeoKungFu says:

    CAPS OFF ?!? Why is all the HTML caps locked ?

  22. The caps is the font in the template, I fixed that now, but we are looking at what is a better solution.

  23. [...] (Источник) Похожие записи:Gmail-тема в стиле Google+Виджет G+ для сайта2 темы оформления в стиле Google+ для Windows 7Скрипты с эффектами из галереи и кругов Google+ (jQuery, CSS) window.___gcfg = {lang: 'ru'}; (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); })(); The Google+ Song (видео) → // [...]

  24. [...] Moss, the Head of SEO at Banc Media and a WordPress plugin developer, has come up with a temporary solution to get a Google+ share button on to your posts, by adding the code directly into your WordPress [...]

  25. [...] Moss, the Head of SEO at Banc Media and a WordPress plugin developer, has come up with a temporary solution to get a Google+ share button on to your posts, by adding the code directly into your WordPress [...]

  26. [...] Moss, the Head of SEO at Banc Media and a WordPress plugin developer, has come up with a temporary solution to get a Google+ share button on to your posts, by adding the code directly into your WordPress [...]

  27. [...] dann habe ich hier noch eine Seite gefunden, die einen Share Button gebastelt hat. Habs noch nicht ausprobiert, [...]

  28. [...] a WordPress plugin developer, has come up with a temporary solution to get a Google+ share button on to [...]

  29. [...] Moss, the Head of SEO at Banc Media and a WordPress plugin developer, has come up with a temporary solution to get a Google+ share button on to your posts, by adding the code directly into your WordPress [...]

  30. [...] interesuje, detaljno uputstvo za implementaciju dugmeta možete pogledati ovde. Blog this! Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via [...]

  31. [...] How to Share on Google+ from any website – State of Search Kommentare: 0 Tweets: 0 Facebook-Likes: 0 15.08.2011 Ads_BA_AD('FOOT'); Das könnte dich auch interessieren:t3n-LinktippsTumblr überholt WordPress, CIA-Website gehackt, Chromebooks Verkaufsstart, Facebooks Foto-Sharing AppDiesmal bei unseren Fundstücken aus dem Netz: Tumblr überholt WordPress, Hackergruppe legt CIA-Website lahm,…t3n-LinktippsCSS3 animiert, SEO mit Google Docs, Sliding Content, Twitter Tools, Facebook stagniertDiesmal bei unseren Fundstücken aus dem Netz: eine Einführung in CSS3 Keyframe Animationen, Social Media Links mit…TechnikLOAD 44 – WordPress 3.2, Facebook-Videochat, Crowdfunding, OS X Lion und das GewinnspielWordPress 3.2 ist erschienen und überrascht uns mit einem Kiosk-Mode und der Schriftart Arial.Google +1 schlägt Twitters Tweet-Button innerhalb eines MonatsGoogle +1 Social Buttons legen einen sagenhaften Start hin. Obwohl sie erst seit etwas mehr als einem Monat verfügbar… Weitere Artikel zu Facebook, Google, Google+, Social Networks und WordPress [...]

  32. Lisa Myers says:

    great, well done Alex. You are right though, the box isn’t pretty or easy to figure out, it doesn’t feel like it’s “legit” if you know what I mean. But it’s very cool and a good start.

  33. [...] aber die Erklärung wie’s geht habe sogar ich verstanden. Alex Moss erklärte damals auf State of Search, wie es zur Überbrückung geht. Hier aber der link zum Plugin und Erläuterung: (klick auf [...]

  34. [...] erfordert die Einbindung des Buttons etwas handwerkliches Geschick. Mit der Anleitung dürfte es aber funktionieren. Trotzdem eine praktische Sache finden wir. Daher haben wir ihn auch [...]

  35. [...] New! How To Share Google+ URLs From A Website: A hack to enable G+ [...]

  36. [...] le titre en anglais du lien «How to Share on Google+ from any website – Google – State of Search» que je traduis [...]

  37. [...] How to Share on Google+ from any website  – State of Search – Alex Moss of Pleer has developed a workaround solution for a Google+ sharing button. You can add it to your site for your visitors to share directly on Google+, in contrast to +1 votes that show up in an extra tab. [...]

  38. [...] How to Share on Google+ from any website  – State of Search – Alex Moss of Pleer has developed a workaround solution for a Google+ sharing button. You can add it to your site for your visitors to share directly on Google+, in contrast to +1 votes that show up in an extra tab. [...]

  39. [...] говоря, не очень. Но выбора как бы нет, так что говорим автору кнопки [...]

  40. dban says:

    hello,

    very good code !

    but, how to share thumbnail ?

    Thank’s

  41. Andy says:

    Is there a URL this will work with that isn’t for mobile?

  42. Andrew James says:

    Exactly what I was looking for Andy!

  43. Yannis says:

    This uses the mobile version of google plus. Is there something equivalent for the desktop version? I’m trying to implement an html only (no script) version of the +1 button.

    • Alex says:

      Unfortunately this is the only way, and has to use the mobile site as Google+ haven’t offered a desktop version of it. Google+ have mentioned that you can share on Google+ once you +1 the URL – but I’m yet to see that for myself

  44. Thanks to your code I was able to craft a nice custom working share button. Thanks so much!

  45. DimitriGilbert says:

    NICE job man :) , i’m going to use it not on wordpress site but on my personnal rss reader :D
    THX a lot !!

  46. Sam says:

    It prompts me to accept the Mobile Terms of Service, and when I click “Accept” it simply refreshes the message. Can’t get past it.

  47. Nam says:

    Same as Sam said. Can’t get past the Accept button. Any workaround?

  48. Alex says:

    The code can now be updated. I have made this into a WordPress plugin now:
    http://pleer.co.uk/wordpress/plugins/google-plus-share-button/

  49. Gtu Magic says:

    Is there a URL this will work with that isn’t for mobile?

  50. [...] what do people share…? Links! And they share many. Surprisingly enough Plus is already the second largest referral to State of [...]

  51. Curtis says:

    Thank you for your work on this Alex.

    Unfortunately I can not get it work. I have tried to add &hideloc=1 to the parameters as you suggested and I think I am not doing it right. Can you provide a code snippet as an example? I would love to implement on my site ASAP.

  52. [...] trước chỉ có thể share qua link mobile, giờ có thêm 1 cách trực tiếp [...]

  53. bleeper says:

    Getting ‘An error occurred. Please try again.’ message. When I try to share. The error also occurs on the share button on this website. Anyone have any thoughts. I’m using a User Agent switcher set to iPhone.

  54. Héctor Omar says:

    Yo can share using the +1 button. Once you clicked on it wait and click on ‘share on Google+’

  55. Jacky says:

    Getting ‘An error occurred. Please try again.’ message. When I try to share. The error also occurs on the share button on this website.

  56. [...] Bookmarklet Google+ dari Aj Batac Tombol Custom Google+dari Alex Moss [...]

  57. [...] experts on G+ points out that this was possibly by a hack using the mobile client as described here http://www.stateofsearch.com/share-on-google-plus-any-website/ Check the comments below. Remember you still have click the post button yourself so it´s no [...]

  58. Andre Morris says:

    You mentioned there’s a way to ‘share’ to the general public using this method. Is there a way to code it so that the public option is selected by default to anyone who clicks?

  59. shruti says:

    Getting ‘An error occurred. Please try again.’ message. When I try to share. Plese help me out that why Am I getting this error.

  60. shruti says:

    Using the below code to share content on google plus. Plese tell me where am I doing wrong:

    <a href='https://m.google.com/app/plus/x/?v=compose&content=

    onclick=”window.open(‘https://m.google.com/app/plus/x/?v=compose&content=','gplusshare','width=450,height=300,left='+(screen.availWidth/2-

    225)+’,top=’+(screen.availHeight/2-150)+”);return false;”>

  61. [...] you’re offering people. There is currently no official ‘Share on Google+’ button (though unofficial ones have been hacked), but this could prove a valuable tool. Even before brands are formally allowed on Google+, the [...]

Comment on this Article:







Full coverage of SES London 2012

Sign up for our newsletter



Join us on Google+

Sponsors

Manual Linkbuilding ___________________________________________________

Recent Comments

  • joe P: First of all google can no more be cal...
  • Gavin Duff: All very basic, really... I can think ...
  • Mukesh: Tips are nice, now time is to work on ...
  • Mukesh: Tips are nice and now time is to work ...
  • Douglas: hate to sound persnickety, but, I thin...

Upcoming Events

SES London 2012 ___________________________________________________
Thinkvisibility 2012 ___________________________________________________
Brighton SEO 2012 ___________________________________________________
SMX London 2012 ___________________________________________________
International Search Summit ___________________________________________________
Blog World Expo ___________________________________________________

Sponsors