This article is also available in:
After successfully registering Google Customer Reviews on Google Merchant Center (GMC), the final step to collect reviews from your customers is to integrate the Survey opt-in module into your store. This article will show you how to integrate the survey opt-in module into your ShopBase store.

In this article

A. What is Google Customer Reviews?
B. Integrate Google Customer Reviews survey opt-in module on your store
C. Verify the results

A. What is Google Customer Reviews?

Google Customer Reviews is a service by Google Merchant Center that allows you to collect valuable feedback from customers who’ve made a purchase on your site. By integrating Google Customer Reviews on your ShopBase store, you can collect reviews and use these reviews to display on your store or marketing platforms.

Example of a customer review on Google

B. Integrate Google Customer Reviews survey opt-in module on your store

Verify your ShopBase website on Google Merchant Center.

From your ShopBase admin, go to Online store > Preferences.


In Additional scripts, Body section, paste the following script to get required variables from ShopBase.

<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer>
</script>

<script>
window.sbsdk.ready(function() {
    window.sbsdk.page.onContextUpdate(function(context) {
        if (context.type === 'post_checkout') {
            // Inject code tracking here
            var estimated_delivery_date = new Date()
            estimated_delivery_date.setDate(date.getDate() + 14);
            estimated_delivery_date.toISOString().split("T")[0];

            window.renderOptIn = function() {
                window.gapi.load('surveyoptin', function() {
                    window.gapi.surveyoptin.render({
                        // REQUIRED
                        "merchant_id": "MERCHANT_ID",
                        "order_id": window.sbsdk.checkout.getOrder().id,
                        "email": window.sbsdk.checkout.getOrder().email,
                        "delivery_country": window.sbsdk.checkout.getOrder().shipping_address.country_code,
                        "estimated_delivery_date": estimated_delivery_date
                    });
                });
            }
        }
    });
});
</script>



To complete the integration, the "MERCHANT_ID" needs to be changed to the merchant ID of your GMC account.

For example, if your merchant ID is 123456789, then the code should be changed to: "merchant_id": 123456789,


Click Save to finish, and your store is now successfully integrated with Google Customer Reviews survey opt-in module.

How to modify the code to change the email review time

By default, the above code of ShopBase will allow you to send product review emails to your customers after 14 days since the order creation date. You can customize this time period to match your store's policy as follows:

Estimated Delivery Date: is the expected date of delivery to the recipient. When this date arrives, the customer will receive an email notification of the product review.
To change the Estimated Delivery Date, replace 14 in the above code with any other natural number. The number to be replaced is the number of days that will be counted from the time the order is created.

For example, if the Estimated Delivery Date of your store is 7, then the code needs to be changed to: estimated_delivery_date.setDate(date.getDate() + 7);

C. Verify the results

After completing all the steps in section B to integrate the Survey opt-in module into your store, you can check if everything is working properly by following the instructions below:

In the above code, replace 14 in the estimated_delivery_date.setDate(date.getDate() + 14); code line with 0 to change the Estimated Delivery Date to 0.


Place a test order on your store. Please refer to these articles on how to place a test order on your ShopBase store, and on your PrintBase store.
Once your order is completed, a survey opt-in will be displayed on the Order Confirmation page to confirm your agreement to receive the review.


Click on Yes, send me the survey and a review invitation email will be sent to the email you used to place to order.



The system can now automatically send review invitations to customers after they complete a purchase.

Related articles

Overview of Preferences
Was this article helpful?
Cancel
Thank you!