This article discusses how to implement Enhanced SEO. If you have not yet decided on an SEO approach and want to learn more about the options and considerations, click here. To learn more about validating your Enhanced SEO implementation, click here. If you are utilizing Shopify as your eCommerce platform, please see Shopify SEO.
PowerReviews offers 3 options for Enhanced SEO:
Option 1: Use the PowerReviews Out-of-the-Box Solution
PowerReviews can provide structured data for the AggregateRating and Review Schemas through a configuration setting that is enabled on PowerReviews' side. Enabling this setting means that LD+JSON markup is injected into the page upon loading, along with the Review Display.
How to Enable
By default, your account will have LD+JSON schema markup enabled for the aggregate rating and reviews. If you do not see this on your website, contact your Implementation Team or PowerReviews Technical Support. If you are creating a product schema through the render function, the following code shows how this can be achieved.
Example:
<script>
window.pwr = window.pwr || function () {
(pwr.q = pwr.q || []).push(arguments);
};
pwr("render", {
api_key: "39135c31-81c8-4de9-b325-45b0e285ec41",
locale: "en_US",
merchant_group_id: "13376",
merchant_id: "771982",
page_id: "ANDRE_SOFA_10",
review_wrapper_url:
"../standalone.4.0.html?pageId=~~~PAGE_ID~~~",
subject: {
"@context": "https://schema.org",
"@type": "Product",
name: "Andre Sofa",
description: "Our Andre Sofa offers unparalleled comfort",
url: "https://www.exampleurl.com/andre-sofa",
image: "https://www.exampleimage.jpg",
sku: "121",
brand: "Example Brand",
offers: {
"@type": "Offer",
priceCurrency: "USD",
url: "https://www.exampleurl.com/andre-sofa",
price: "21.49",
priceValidUntil: "2020/06/25",
availability: "https://schema.org/InStock"
}
},
components: {
ReviewSnippet: "pr-reviewsnippet",
ReviewImageSnippet: "pr-imagesnippet",
ReviewDisplay: "pr-reviewdisplay"
}
});
</script>
By adding data for the product in question to this function, a product schema is created on the page along with the AggregateRating and Reviews Schemas. The "subject" can accept the various parameters that can be used for a detailed product schema (further documentation on product schemas can be found at https://schema.org/Product).
PowerReviews generates schema markup for all component types, including Category Snippets. As a best practice, some search engines suggest not generating markup for category pages, and the following flag can be added within the render function to disable the schema markup from generating: ENABLE_CLIENT_SIDE_STRUCTURED_DATA: false
Example:
<script>
window.pwr = window.pwr || function () {
(pwr.q = pwr.q || []).push(arguments);
};
pwr("render", [
{
ENABLE_CLIENT_SIDE_STRUCTURED_DATA: false,
locale: "en_US",
merchant_group_id: "49047",
page_id: "7799373259",
merchant_id: "512774",
api_key: "ec8f9acb-be0e-489b-a6ff-3eed3811025e",
review_wrapper_url: "https://www.prdemostore.com/pages/write-a-review/?pr_page_id=___PAGE_ID___",
components: {
CategorySnippet: "snippet-7799373259"
}
},
{
ENABLE_CLIENT_SIDE_STRUCTURED_DATA: false,
locale: "en_US",
merchant_group_id: "49047",
page_id: "7772277707",
merchant_id: "512774",
api_key: "ec8f9acb-be0e-489b-a6ff-3eed3811025e",
review_wrapper_url: "https://www.prdemostore.com/pages/write-a-review/?pr_page_id=___PAGE_ID___",
components: {
CategorySnippet: "snippet-7772277707"
}
},
{
ENABLE_CLIENT_SIDE_STRUCTURED_DATA: false,
locale: "en_US",
merchant_group_id: "49047",
page_id: "7751057291",
merchant_id: "512774",
api_key: "ec8f9acb-be0e-489b-a6ff-3eed3811025e",
review_wrapper_url: "https://www.prdemostore.com/pages/write-a-review/?pr_page_id=___PAGE_ID___",
components: {
CategorySnippet: "snippet-7751057291"
}
}
]);
</script>
Option 2: Build the AggregateRating and Reviews Schema using the on_render callback
This option assumes you are already including a product schema to your website and would like to build the AggregateRating and Reviews schema into your product pages. In this case, the on_render callback can be used to retrieve the average rating and review count, build the necessary markup, and add it to your product page.
This solution is not currently supported if you are utilizing Shopify as your eCommerce platform.
How to Enable
Contact your Implementation Team or PowerReviews Technical Support to ensure that schema markup is not being generated automatically per Option 1 above, as this can interfere with any new schema markup that will be added.
Add the on_render callback along with the accompanying JavaScript to your pwr render config.
Please see the following example (note that this assumes you are using a product schema, defined in a script tag in LD+JSON format, with the id of "productschema" -- please be certain to make adjustments as needed). The code provided is just one example of how this can be accomplished and will not work in all scenarios.
Example:
<script>
window.pwr = window.pwr || function () {
(pwr.q = pwr.q || []).push(arguments);
};
pwr("render", {
api_key: "39135c31-81c8-4de9-b325-45b0e285ec41",
locale: "en_US",
merchant_group_id: "49047",
merchant_id: "512774",
page_id: "7751057291",
review_wrapper_url:
"ui.powerreviews.com/stable/standalone.html?pr_merchant_id=512774&pr_p
age_id=7751057291",
on_render: function(config, data) {
if((config.component === 'ReviewSnippet') &&
data.average_rating && data.review_count) {
var aggregateRating = {};
aggregateRating['@context'] = "http://schema.org/";
aggregateRating['@type'] = 'AggregateRating';
aggregateRating['ratingValue'] = data.average_rating;
aggregateRating['reviewCount'] = data.review_count;
var scriptTag = document.getElementById("productschema");
var scriptTagObject = JSON.parse(scriptTag.innerHTML);
scriptTagObject["aggregateRating"] = aggregateRating;
scriptTag.innerHTML = JSON.stringify(scriptTagObject);
}
},
components: {
ReviewSnippet: "pr-reviewsnippet",
ReviewDisplay: "pr-reviewdisplay"
}
});
</script>
If you'd like to configure Review schemas as part of Option 2, please see our related on_change documentation.
Option 3: Build the AggregateRating and Reviews Schema with the ReadServices API
This option assumes you are already including a product schema to your site and would only like to build in the AggregateRating and Reviews schema to your product pages. In this case, the ReadServices API would be used to retrieve all values needed to build out the AggregateRating and Reviews Schema. This approach would require the most additional work on your end but also allows for a complete solution as all relevant values can be retrieved from the API to build out the Review Schema. This is in contrast to Option 2, which only allows for the average rating and review count to be returned.
How to Enable
In order to continue with this option, contact your Implementation Team or PowerReviews Technical Support to ensure you have API access.