How to Use Aggregate Review Schema to Get Stars in the Search Results for Local Businesses

Have you ever envied these review sites with the nice yellow stars in the search results, like Yelp, Angie’s List, HomeAdvisor and others? What if I could explain you how YOU can get these yellow stars for pages from YOUR site quite easily?


In this post, I’m going to show how you can create similar search results for your site, like we created for a LocalSpark client of ours, Yonkers Avenue Dental:

Invisalign Yonkers - Check out the review stars!
And of course we also implemented it for our own site:
Local SEO service - Check out the review stars





Have I gotten your attention? Then keep on reading and within 10 to 15 minutes from now you will be able to add stars to your own site, too.


JSON-LD for aggregated reviews


A while ago, we published the post “The JSON-LD Markup Guide To Local Business Schema” in which Gene Maryushenko explained how you can use JSON-LD to define a lot of additional data for your local business.


To get the review stars on your site, we’re also going to use JSON-LD. But instead of using the LocalBusiness vocabulary, we’re going to use the “AggregateRating”. Don’t worry, it sounds more difficult than it actually is.


To illustrate this, check out the simple code below:



<script type="application/ld+json">
 { "@context": "",
 "@type": "Product",
 "name": "Invisalign",
 {"@type": "AggregateRating",
 "ratingValue": "4.9",
 "reviewCount": "7"

This is really all the code we added to the Invisalign page of our client. As you can see, we can define the name of the product/service, the score and the number of reviews ourselves. There are a few important points to consider though…


Important prerequisites


There are a few conditions which seem to have a positive impact on getting (and keeping!) the review stars in the search results:


      Don’t try to place them on your homepage; Google states: “Review and rating markup should be used to provide review and/or rating information about a specific item, not about a category or a list of items. For example, “hotels in Madrid”, “summer dresses”, or “cake recipes” are not specific items.” (hence, homepage is also not allowed and will not be shown, so it’s a waste of time and energy). You might have seen them on homepages in the past, but they seem to have disappeared since the end of 2014.


      Have a “reviews”-page with reviews listed on it sometimes helps to get the rich snippets shown for your site.


      ‘ratingValue’ is numerical, ranging from 0 to 5, but don’t award yourself only 5 on all your services: don’t go overboard with your scores.


      Keep ‘reviewCount’ within reason. Anyone observing only 3 reviews on Google, 1 on Yelp and 4,532 on your own site, sees right through it and the effect will be quite the opposite: you’ll turn people away from your site.


      Don’t add review stars to all pages at once, but add them gradually over time.


      Don’t expect the stars to show up for all pages you put the code on. Your page needs authority and page rank in order for the stars to appear.


But done wisely, having the review stars in the search results for your local business’ products and/or services can have a positive effect on the CTR (Click Through Rate).


How to implement the aggregate review


I am going to explain you two ways of implementing the aggregate review on your site. The first one is very easy and works for almost any CMS (Content Management System), whilst the second is specifically for WordPress.


Implement review stars the easy way in (virtually) any CMS


Almost any Content Management System supports editing the HTML of a page or a part of a page. Access to the HTML is all you need. Because the JSON-LD code is invisible for the visitor, it’s still indexed as markup by the search engines.


So, login to your CMS, open up a page you want to add the review stars to and switch to HTML editing mode. Then find a nice spot, e.g. just before the part and add the code below:

<script type="application/ld+json">
 { "@context": "",
 "@type": "Product",
 "name": "##PRODUCT###",
 {"@type": "AggregateRating",
 "ratingValue": "##RATING##",
 "reviewCount": "##REVIEWS##"

Replace the fields ##PRODUCT##, ##RATING## and ##REVIEWS## with the desired values, save the page and that’s it!


In case you’re using some kind of caching mechanism, you might need to empty the cache. And it helps to submit the page for indexing through Google Search Console, as this speeds up the stars to appear in the SERPs.


Remain patient: we’re seeing an average delay of about 3-4 days before the stars appear. But as always: YMMV… Good luck!


Implement review stars in WordPress through a custom field


For another client of our LocalSpark program, we had the review stars appear in the SERPs by simply adding some PHP code in a page template to allow the rating be controlled by a custom field within WordPress.


The PHP code we added to the page was as simple as the code below:


if ( ($pagerating = get_post_meta( $post->ID, ‘rating’, true ) )) {


$rating = explode( “/”, $pagerating );


$score = $rating[0];


$reviews = $rating[1];


$product = get_the_title();


$ratingoutput = ‘// <![CDATA[
{"@context": ";,"@type": "Product","name": "'
. $product . ‘”,”aggregateRating”: {“@type”: “AggregateRating”,”ratingValue”: “‘ . $score . ‘”,”reviewCount”: “‘. $reviews . ‘”}}
// ]]>’


echo $ratingoutput . n;






 The custom field ‘rating’ was specified for each page:


Using a custom field within WordPress for getting the aggregated review stars in the SERPs


The correct format is the numerical score (also ranging 0 to 5), followed by a slash and the number of reviews to be shown in the search results.


It’s important to know that the PHP code above uses the page title as the name of the product. You might want to change this to suit your needs.


if you’re not sure how to add a custom field to your WordPress site, you can have a look here:


Ready to aim for the stars?


I hope that I’ve set you on the right track for implementing the aggregated review stars on your products and/or services pages. Like I said before: implement them wisely, otherwise you risk losing them altogether!


Don’t hesitate to leave any questions, remarks, hints ‘n tips in the comments below!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s