Top Lines

Using Schema.org to show your Average Review Stars in Google's Search Engine Results Pages (SERPS)

by Dave Reeder , 10 September 2019

Dave Reeder
Using Schema.org to show your Average Review Stars in Google's Search Engine Results Pages (SERPS)
It's great ranking on Google for certain search terms, but what if there was a way you could stand out even more from the competition, with minimum effort?

There is!  Read this article to find out how to add ratings stars to your search result in Google's Search Engine Results Pages (SERPS).

It's called a "rich snippet", which is special piece of code that Google reads in your page to learn more about your site and adds to your organic listing.  In this article we are especially interested in one rich snippet, which is called AggregateRating.

What is AggregateRating?

AggregateRating is a schema.org rich snippet that Google will read and then place your ratings directly in your search result listing.  The official page telling us about AggregateRating is here.

If you're not a developer you'll find that page confusing, but you don't need to worry about it.

What do we need to add ratings in the SERPS?

So to add ratings to your website in Google's search results, we need two things:

  • Access to the code on your website or ability to add plugins
  • Your reviews added on your site, or ready to add to your site

Some other things to bear in mind:

  • You cannot add your ratings on your Home page - Don't bother trying it, I did and it doesn't work.  Instead add them on a sub page for a service or product where they can bolster that pages offering.
  • For Wordpress here is an interesting article I found on the subject: https://multiratingpro.com/rich-snippets-ratings-reviews

How did we do it?

As you know we are big fans of Concrete5 and that's what Made Simple Media is built in.  Here's how we went about adding the reviews with the ratings rich snippet:

We built a block

We built a nice reviews block using Block Designer Pro with a repeatable field so we can add all our reviews with a star rating for each one:

Reviews Block

We obviously had to style this to render out the correct amount of stars and we added Slick slider to turn it into a carousel, but you don't need to do that to show the reviews in the SERPS.

The critical thing is to dynamically work out the total reviews and the aggregate rating.  Without that weighted average rating, we can't give Google a single rating number to show in the search results.

So next we loop through our code and add up the number of 5 star reviews, number of 4 star reviews etc to calculate the weighted avergage as per this example

We also need the total reviews, which is simple using PHP count():

$reviewCount = count($review_items);

The AggregateRating Rich Snippet

Here is the final code, complete with our PHP variables for average rating and review count:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Product",
  "name": "Web Design & Development",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "<?php echo $avgRating; ?>",
    "reviewCount": "<?php echo $reviewCount; ?>"
  }
}
</script>

Telling Google to re-index the page

To get Google to re-index the page and start showing the ratings in the search results, you can go to Search Console (if you set it up with your website) and go to URL Inspection, then add the url you want to in the box that says "Inspect any URL in [website name]:

URL Inspection

Then on the next page, click "Request Indexing":

Request Indexing in Search Console

Conclusion

Using rich snippets in the organic listings is a great way to really stand out from the crowd and it helps build trust with your visitors because they can see reviews from your customers.

If you want to add ratings to your website, please get in touch and we can help do that for you.

Join the Discussion...


Back to Blog

Get Important News & Offers

Enter your email to receive monthly news and special offers from Made Simple Media:

You can unsubscribe at any time, please read our privacy policy for more information.

Get a FREE Quote...

Contact our friendly team for a FREE no-obligation quote...

Call now on 0800 111 4504

Stay Informed...

Enter your email address to receive occassional emails with special offers, relevant news and useful tips:

Please note, we never share your data with any third party and you can unsubscribe from emails at any time and request that your data is deleted.