...
Once verified, follow the integration instructions to add the code snippet below to the order confirmation page and adjust the variables as needed. Integrating the snippet is required for Google to show the opt-in for Google Customer Reviews in the shop.
Code Block |
---|
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
<script>
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
// REQUIRED FIELDS
"merchant_id": 113149439,
"order_id": "ORDER_ID",
"email": "CUSTOMER_EMAIL",
"delivery_country": "COUNTRY_CODE",
"estimated_delivery_date": "YYYY-MM-DD",
// OPTIONAL FIELDS
"products": [{"gtin":"GTIN1"}, {"gtin":"GTIN2"}]
});
});
}
</script> |
Integration of google reviews logo
Indicate with the logo that the shop participates in the Google Customer Reviews program and includes the seller rating on your website.
First, paste the code snippet at the bottom of any page on your website and adjust the variables as needed. Then, check that the logo and associated text are displayed on your website as expected. Note: If there are no seller ratings, the message "No rating available" will be displayed.
...
Magesuite integration
In checkout_onepage_success.xml reviews-survey block is included:
Code Block |
---|
<referenceContainer name="before.body.end"> <block class="MageSuite\GoogleCustomerReviews\Block\Survey" name="magesuite.google_customer_reviews.survey" template="MageSuite_GoogleCustomerReviews::survey.phtml"> <arguments> var ratingBadgeContainer<argument name= document.createElement("div");"view_model" xsi:type="object">MageSuite\GoogleCustomerReviews\ViewModel\Survey</argument> </arguments> document.body.appendChild(ratingBadgeContainer);</block> </referenceContainer> |
The badge block is included on every page (default.xml):
Code Block |
---|
<referenceContainer name="before.body.end"> window.gapi.load('ratingbadge', function() {<block name="magesuite.google_customer_reviews.badge" template="MageSuite_GoogleCustomerReviews::badge.phtml"> <arguments> window.gapi.ratingbadge.render(ratingBadgeContainer, {"merchant_id": 113149439}); }); } </script><argument name="view_model" xsi:type="object">MageSuite\GoogleCustomerReviews\ViewModel\Badge</argument> </arguments> </block> </referenceContainer> |