Showing product rating stars on Google Search results is an important way to drive traffic to your product pages. With Okendo, it's easy to get your average rating and review count data to show up in Google Search results. This guide will show you how it's done.
Automatic
If you've run the Okendo Auto-Installer recently, everything will already be set up correctly. Just make sure to publish the theme created by Okendo and you'll be good to go. To verify the setup, see Verifying Your Setup below.
Manual
If you performed a manual installation of Okendo then you'll need to set up some files in your theme so that Google can find your review data to show in their search results.
New JSON-LD Setups
If you don't have any existing JSON-LD rich snippets set up on your store, follow these steps to set it up:
1 - In your theme, create a file in the snippets
folder called okendo-reviews-json-ld.liquid
2 - In that file, add the following:
{% if request.page_type == 'product' and shop.metafields.okendo.settings.isJsonLdSnippetEnabled == true %}
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": {{ product.title | strip_html | strip | json }},
"image": "https:{{ product.featured_image | product_img_url: '450x450' }}",
"description": {{ product.description | strip_html | strip | json }},
"mpn": "{{ product.id }}",
"brand": {
"@type": "Brand",
"name": {{ product.vendor | strip_html | strip | json }}
},
"offers": {
"@type": "Offer",
"priceCurrency": "{{ shop.currency }}",
"price": "{{ product.selected_or_first_available_variant.price | money_without_currency | remove: "," }}",
"availability": "{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
"seller": {
"@type": "Organization",
"name": {{ shop.name | strip_html | strip | json }}
}
}
{% if product.metafields.okendo.summaryData.reviewCount > 0 %}
,"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{ product.metafields.okendo.summaryData.reviewAverageValue }}",
"ratingCount": "{{ product.metafields.okendo.summaryData.reviewCount }}"
}
{% elsif product.metafields.okendo.ReviewCount > 0 %}
,"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{ product.metafields.okendo.ReviewAverageValue }}",
"ratingCount": "{{ product.metafields.okendo.ReviewCount }}"
}
{% endif %}
}
</script>
{% endif %}
3 - Save
4 - Include that file in your theme layout file (theme.liquid
) by adding {% render 'okendo-reviews-json-ld' %}
to your header section (between <head>
and </head>
)
Existing JSON-LD Setups
If you already have JSON-LD rich snippets set up on your store, add this snippet to the appropriate place in your existing file (normally on the line before the closing }
of the section denoted by "@type": "Product"
) and save:
{% if product.metafields.okendo.summaryData.reviewCount > 0 %}
,"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{ product.metafields.okendo.summaryData.reviewAverageValue }}",
"ratingCount": "{{ product.metafields.okendo.summaryData.reviewCount }}"
}
{% elsif product.metafields.okendo.ReviewCount > 0 %}
,"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{{ product.metafields.okendo.ReviewAverageValue }}",
"ratingCount": "{{ product.metafields.okendo.ReviewCount }}"
}
{% endif %}
Existing JSON-LD files are normally found in the snippets folder and may have (but are not limited to) the following names: json-ld.liquid
, microdata.liquid
, SEO-manager.liquid
Verifying Your Setup
To verify that the JSON+LD has been installed properly, head over to the Structured Data Testing Tool.
If you've set this up on your live theme, go to a product page and paste the URL into the testing tool. If you've set this up on a different theme, first preview the theme and then navigate to a product page and paste the URL into the testing tool.
On the right, there should be a row of sections labelled Product, click any of the sections to check if JSON+LD is installed correctly by ensuring all the necessary fields are present and there are no errors. Note: If a Product section has no reviews or is still in Okendo preview mode, then don’t worry about the warning for aggregate rating.
Disabling Rich Snippets
Rich snippets are turned on by default for all new Okendo customers. However there may be cases where you'd like to turn off the snippet provided by Okendo (eg. If an agency is managing your SEO configuration). To do so, go to your Widget Settings in Okendo and disable "Include SEO Rich Snippets".
If the setting doesn't appear on your store, it may be because you were setup before the addition of this feature. Please contact Okendo Support to get set up.