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 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. Best practice would be only to add review counts for actual reviews that are listed on the page.

  • 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

There are 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 </body> 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 = '<script type="application/ld+json">{"@context": "","@type": "Product","name": "' . $product . '","aggregateRating": {"@type": "AggregateRating","ratingValue": "' . $score . '","reviewCount": "'. $reviews . '"}}</script>';
    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!


Eduard de Boer

Eduard started with hand-coding websites in 1993 and became immersed in SEO, reputation management and content marketing in the years thereafter. After almost two decades Eduard is still following his passion: consulting and helping companies to profile themselves better. Eduard is also a certified Google Maps Business Photographer.

Follow Me on Twitter

58 comments on “How to Use Aggregate Review Schema to Get Stars in the Search Results for Local Businesses

  • Excellent write-up!

    And, one that for me, conjures flashbacks to circa 2012 when Mike Wilton over at Search New Central called me out on this very topic.

    I had been one of the early adopters to use schema to parse star ratings into SERPS and had successfully performed the implementation for a client. Here is the link to the original discussion:

    I still maintain that implementation of schema rating markup, if not used with extreme discretion and accuracy, may lead to a deceptive user experience in the SERPs. Sadly, I think the temptation to manipulate the stars will be far to strong for many SABs and agencies to resist.

    However, for those who are willing to fly straight and implement aggregate rating markup which communicates user-submitted reviews with 100% accuracy – a significant increase in CTR may lie just ahead for you.

  • Great post, Eduard!

    For the CMS version, are you saying in WordPress that we can just switch to the “text” option and then paste that script in?

    Thanks again!

  • Morning Eduard, So are you saying that the product name needs to be the name of the page that you put the code on? And that this page needs to be a particular product item rather than a generic like summer dresses?

  • Very basic question, but shouldn’t your markup always reflect what’s on the page? Is it okay to show aggregate ratings if you aren’t showing the reviews that those ratings come from?

  • All good Eduard 🙂 However I feel sorry for those who add the code without any actual reviews… pathetic. (e.g.) search “grow up and get a life seo calgary” and you’ll see an example – this “SEO” claims a 4.9 Rating with 37 reviews… yet he has NO reviews on the page.

  • @Dino / @Andy : Thanks for the positive feedback. I agree: it’s kinda pathetic to fake the reviews.

    @Mike: You can paste the real scoring piece in the text piece of your CMS or add the PHP code to a page template in WordPress and add the reviews score through a custom field.

    @Jo: For the name you can choose any name which you find appropriate. And indeed: acc. to Google’s guidelines, aggregated reviews are only allowed on product / service pages. Not on these sort of category pages as “summer dresses”.

    @Rich: In general, yes. But it seems that it’s OK to have reviews listed on a reviews page, whereas you add reviews to individual product or service pages. Ideally you’d have reviews as an addition to the content on individual product or service pages.

  • Hi Eduard,
    Does the php code automatically adjust the ratings up/down as new reviews are left on the page? Or is it all a manual process. I am looking to implement it on a wordpress site.

  • Hi Daryl,

    Thanks for stopping by and asking your question! Keeping the reviews actual automatically would involve way more code. So unfortunately, you will have to manually update the score every now and then to reflect the actual number of reviews.

    – Eduard.

  • It seems you are suggesting that businesses put this AggregateRating score on random pages on their site (except the home page). The entire idea of this review schema is to show an aggregated view of valid reviews for a product/page/etc. If the business isn’t collecting reviews, they shouldn’t be doing this. You should make that crystal clear in this post.

  • I love this idea and thank you so much for documenting how you achieved success with this!

    However… I’m still worried this might not quite abide by Google’s guidelines, copied here: “Make sure the reviews and ratings you mark up are readily available to users from the marked-up page. It should be immediately obvious to users that the page has review or ratings content.”

    Wouldn’t this mean that you shouldn’t include any aggregate markup unless each and every review it’s an aggregate of is also on that page…?

  • Hey Eduard,

    Great post!

    Quick question. I’m doing SEO for a local property management company (one location). They currently rank 1-2 for all PM related keywords. However, some of the “[location] rentals” related keywords are bottom page 1, top page 2. A lot of SERP real estate is being swallowed up by the Trulia, Zillow and Craigslists of the world 🙂

    I want to add some review markup to their rental listings page. There is only 1-2 reviews showing in a sidebar widget on the page. However, they have a 4.6 star rating from 80 reviews on G+.

    How would you approach this? I’d like to add the review stars to the rental listing page so that I can boost CTR in the SERPs and hopefully give the page a bit of a bump?

    Any insights appreciated.


  • I agree with Andy’s comment that it wouldn’t be right to add the code without any reviews. It seems that the reviews don’t always have to be on the same page. They just have to exist to be ethical. The Invisalign example above has no reviews on that page, but there is a page of reviews on that site with many more than is stated, particularly if you include those found in the YouTube video.

    My first thought in reading this was, “Oh, great! That will help with the disappearing reviews.” Then my thoughts quickly turned somewhat cynical. There’s abundant abuse in this industry of any practice that offers any sort of advantage but doesn’t take a lot of time or effort. Now this article has been published, I’d be surprised if this practice doesn’t become so abused that it won’t have any value at all.

  • For a service business with multiple service types (i.e. lead inspection vs. mold inspection) and multiple locations, how should we organize our customer ratings? Or should these be placed on a location page (i.e. or Our customers currently fill out surveys after the inspection via a WuFoo form.

  • Hey Eduard,
    I would like to thank you for the great blog. I was a bit confused about schema before I read your blog, but now I can say that I am clear about schema markup. I have implemented the same on one of my client sites and it works.

  • Thanks for the write up. There will always be people that abuse things like this. When you try to get a slight edge over your competition to stand out someone has to “one up” you and give themselves more reviews then they actually have.

  • Hi,
    I understood completely about the static JSON LD code.

    But suppose, my website is not having WordPress as CMS and I want to create Dynamic JSON LD then how could I?

    I am searching for this answer since last 4 months. I hope I could get from this blog.

    Many thanks in advance!

    • Hi Bhargav,

      Thanks for your question. It all depends on the CMS you’re using. I think the code above should give you a direction on what you’ll need to generate within your CMS in order to get the review stars on your site.

      It is impossible to help you out without knowing more context. Feel free to reach out to me if you’d like more targeted help.

      Regards, Eduard.

  • Hi Eduard,

    I really like the content you’ve talked about. Thank you for the information.
    I have a question regarding the reviews. Lets suppose I have some rating about my organization on Google Maps (i.e. Rating 4,1/5 – 8 Reviews), can I then input for my orgranization a JSON-LD in the Google Tag Manager like this:

    { “@context”: “”,
    “@type”: “Product”,
    “name”: “Invisalign”,
    {“@type”: “AggregateRating”,
    “ratingValue”: “4,1”, // Does Google accept static values for ratingValue and
    “reviewCount”: “8” // reviewCount?

    P.S.:The reason I would like to use JSON-LD + GTM is because I dont have acces to my HTML files, which means I wouldn’t be able to add the code before closing the !

    Thank you very much in advance.

    • Hi Beresja,

      Yes, you can technically seen.

      But you need to specify “ratingValue” with a decimal dot and you can only use it on a sub page (e.g. the “Invisalign” service page), NOT on the site’s homepage.

      Hope this clarifies it a bit.

      If not, let me know.

      • Hi Eduard,

        first of all let me thank you for the reply.

        The problem here is that I dont know if it is against Googles Policies to put a “ratingValue” that is not dynamically and somehow verified. What I mean by that is, everytime someone writes a review, I would have to update the JSON-LD!?

        In turn I could say that my ( ratingValue = “4.8” ; reviewCount = “5465” ) which is not true.

        Kind regards,

      • Could we take one of our reviews from tripadvisor (mark it with rich snippet) and put it in the footer of the page or is it better to have reviews page and mark couple of reviews on that page?

        I ‘am asking because I read that marking a review (rich snippets) on an index page is not something that google like?
        „Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.“ or „Sites must collect ratings information directly from users and not from other sites.“
        We have 453 reviews on tripadvisor (average rating 5.0) so we want to use one in the footer of the page (with rich snippet structured data) and

        {“@type”: “AggregateRating”,
        “ratingValue”: “5”,
        “reviewCount”: “450”
        with link to tripadvisor page, but according to this google guidelines this is not legal or desirable. Could we have your opinion, because we don’t see why we can’t use our reviews from other sources?!

  • So, not sure if there’s been a follow-up article written here or not, but would love to hear your thoughts on how this is working out for you. I’ve read a lot on this subject and all seem to suggest your usage here is not what Google had in mind.

    Though you were able to get it working with your listings temporarily, I’m guessing Google has caught up to you and removed this extra markup in your organic results?

    • That’s my guess. I had implemented this into a website and it was showing up for a couple months in SERP. But then Google dropped the hammer apparently. I was forced to remove it (via a message they sent in Google Search Console).

  • Hi Eduard, great blog. it does give basic concept of the markup code we need.

    However i have a question

    Should that be AggregateRating like the first link or Review-aggregate like the second link?

    Would google be able to crawl these reviews and show stars under google search?
    Cause with the first link*

    There’s no stars shown even the link got two reviews.

    If you could be a sweetheart and tell me the problem, would be much appreicated! Thanks

  • Google review rating in Google SERP under website link:

    We have 21 google reviews. All of them are 5 stars and from real
    customers. Now I want these stars/ratings to show up in google search
    results page when our website shows up. How to do this?

    With Google Place API result json i can find the Rating 5…..&key=AIzaSyCjJwThy……

    can i show this parsed rating on webpage so that google when crawl my
    page and get actual rating which is on Google Review in the right side
    of Serp result.

    My main motto to show the real same rating in SERP which is in Google Review star rating in the right side of Serp result.

    I know the Google Rich Schema is there.. but these seems static result and fake result..

  • @eduarddeboer:disqus So the take away I’m getting out of this is “Markup services as products and you can manually enter whatever rating you’d like.” Am I wrong?

    I think Google ought to be providing some kind of way for people to link their business with it’s Google My Business / Google+ reviews to get that to display for their home + service pages.

  • Hi Eduard , Thanks for this interesting article. Is it also possible to display event-dates as well as rating stars for this event at the same time in the Serps? If yes how can I realize it? Thanks in Advance! Hendrik

  • Excellent stuff! You forgot to mention the downside of marking up fake information. Overdoing or adding spammy structured data can get you in trouble as well.

    • This is true. Structured Data Mark up for review must now visible to the User. if you will use this method there is a greater chance that your site will be mark as spammy structured data.

  • Hi Eduard,
    Thank you for providing the PHP script for WordPress, question though, why is there an “n” on the last line? echo $ratingoutput . “n”;
    Thanks again for this valuable information!

  • I have a new website. the web rental real estate designer put is some of my 5 star reviews from another site and I have a review page, 1 property, and wordpress. Im a major newbie here. I have 19 of 19 5 stars reviews on by old site. Can I add them into my new site, let goole know, and tell google to put the stars on my google search.

  • I didn’t know what rating to input into the code. I initially thought that Google automatically puts the numbers in based on the review stars and number of ratings.
    This post clarified all that and in addition, it included the JSON LD code as well.

  • I always wanted to learn about how these stars display with some pages in SERP. Glad I come across your website. I have placed the code let see if it works for me.

  • Dear Sirs,

    Could we take one of our reviews from tripadvisor (mark it with rich snippet) and put it in the footer of the page or is it better to have reviews page and mark couple of reviews on that page?

    I ‘am asking because I read that marking a review (rich snipets) on a index page is not something that google prefer?

    {“@type”: “AggregateRating”,
    “ratingValue”: “5”,
    “reviewCount”: “450”

  • Could we take one of our reviews from tripadvisor (mark it with rich snippet) and put it in the footer of the page or is it better to have reviews page and mark couple of reviews on that page?

    I ‘am asking because I read that marking a review (rich snippets) on an index page is not something that google like?
    „Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews.“ or „Sites must collect ratings information directly from users and not from other sites.“
    We have 453 reviews on tripadvisor (average rating 5.0) so we want to use one in the footer of the page (with rich snippet structured data) and

    {“@type”: “AggregateRating”,
    “ratingValue”: “5”,
    “reviewCount”: “450”

    with link to tripadvisor page, but according to this google guidelines this is not legal or desirable. Could we have your opinion, because we don’t see why we can’t use our reviews from other sources?!

  • Is it possible to make aggregate rating not for whole lifetime of a page, but just for recent year? I know technically is possible, but will Google penalize my site?

  • Ok, I implemenented that schema markup in my website and guess what? Stars are now displaying with my listing in search engine. So happy.
    Thank you

  • Dear Sir,
    I try to place snippet code intro my website.
    But it is not display on google search.
    It only display when i search by site:domain-name

  • Great guide Eduard.

    I’m starting to see some manipulative SEO’s using this technique on pages that do not have actual reviews on them, unfortunately. But either way, great article!

  • Great post – thank you for explaining this in easy to follow language and for including instructions not just for wordpress, but for non-wordpress sites. Added the code to 1 page. Crossing my fingers!

    One question – you mentioned that best practice is not to put more reviews than what are actually displayed on the page. If my site is not the type of site where people purchase items online and then review it – so my page doesn’t have actual reviews, except for the few reviews that I’ve copied from review sites and put there (text only). Does that mean I shouldn’t actually be doing the review schema markup?

  • Appreciate the writeup! One question – what if your company really does only have 5 star ratings? It can’t be perceived as manipulating if it’s true, right?

  • How can this be added to Shopify site? We have like 5,000 real reviews, that people can find across our sales channel, but we would like to be able to get that credibility on our site as well!

    Fantastic article, thanks!

  • Hi there, great article very clear and makes sense. The main question I’d ask is surely you need to be able to show where the review stats come from? I would take the stats from my GMB page and also link to it under the review details on the page where you put the code? Any thought son that?

Comments are closed.