Over a million developers have joined DZone.

Add Google+ Comments To Your Site

DZone's Guide to

Add Google+ Comments To Your Site

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

On the 18th April 2013 Google announced that they have made a Google Plus commenting system which you can have on your website just like the Facebook comments. This allows people to come to your site and when they comment on an article this comment will be shared on Google plus.

Google+ Comments

The difference that Google plus comments has over Facebook comments is a massive benefit of including all comments from Google plus on your page. This means that if someone shares your article on Google plus it will appear in your commenting system, if this then leads to a conversation happening on Google Plus about your article this will also appear on your comment system. So all conversations that are happening about your page will come through and be displayed on your website. This allows you to keep in touch with every conversation that is happening on Google plus about your page.

This solves the problem of multiple conversations happening in different places, your comment system, your personal Google+ page, your blog Google+ page, Google+ community pages, other people sharing your articles on their page. All of these conversations will be joined together on your blog, allowing you to keep track of all of them in one place. With most conversations about articles happening on social media now this can be a massive benefit to your blog on Google+.

When someone comments on your article they are given the choice if they want to share their comment publicly or with specific circles, which means when someone comments they are also sharing your articles.


How To Get Comments

This was first made available for Google's own blogging platform Blogger, they have made this very easy to turn on inside Blogger you just enable it and Google+ comments will appear in your Blogger site.

This is not yet officially available to other blogging platforms like WordPress, but that doesn't stop Web Developers coming up with a way of getting comments on your site.

Within a couple of days of this being available on Blogger a WordPress plugin was released which allows you to use Google+ comments on any WordPress site, you can download it from here.

Google Plus Comments

Comments For Any Site

But what if you want the Google Plus comments on any site not just on a Blogger or WordPress site?

There is a way you can simply add some Javascript to your page to get all the features of the Google+ commenting system. The following code will add the Google+ commenting system to any page.

<script src="https://apis.google.com/js/plusone.js">
<div class="g-comments"
    data-href = window.location
    data-width = "650"
    data-first_party_property = "BLOGGER"
    data-view_type = "FILTERED_POSTMOD">

Display Comment Count

On most blogs it's common to display the comment count at the top of the page, if you want to display the Google+ comment count you can use the following code.

<div class="g-commentcount" data-href="[URL]"></div>

Just replace the [URL] with the current page.

Render Comments Dynamically

If you want to display the comments dynamically with a click event for example then this can be done by calling the function gapi.comments.render(containerId, settings);

With the Google API Javascript on the page there will be an object of gapi, this is what we use to render the commenting system.

<div id="google_comments"></div>
gapi.comments.render('google_comments', {
    href: window.location,
    width: '650',
    first_party_property: 'BLOGGER',
    view_type: 'FILTERED_POSTMOD'

Code source: Browsing The Net

Which Commenting System To Use?

With all of the commenting systems you can choose from which is the best one to use. We have a choice between native blogging comments, Disqus comments, Jetpack comments, Facebook comments, Google+ comments etc...so which is the best one to use, let me know what you think.

Are you going to use Google Plus Comments on your site?

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}