Difference between revisions of "Adding Google Customer Reviews to your store"

From Spiffy Stores Knowledge Base

Line 34: Line 34:
 
           // OPTIONAL
 
           // OPTIONAL
 
           "opt_in_style": "CENTER_DIALOG",
 
           "opt_in_style": "CENTER_DIALOG",
           "products": [{% for item in order.line_items %}{"gtin":"{{ item.variant.barcode }}"}{% unless forloop.last %}, {% endunless %}{% endfor %}]
+
           "products": [{% for item in line_items %}{"gtin":"{{ item.variant.barcode }}"}{% unless forloop.last %}, {% endunless %}{% endfor %}]
 
         });  
 
         });  
 
     });
 
     });

Revision as of 10:26, 15 March 2018

Please note that at this time, the survey opt-in for Google Customer Reviews is not available due to Google's domain requirements. We are investigating a way to make them available to all stores and will update this page with more information when it becomes available.

Google Customer Reviews is a free program that allows Google to collect seller reviews (and optionally, product reviews) on your behalf from your customers. Signing up can take less than a few hours and allows you to place a badge with the Google brand and your seller rating on your website.

How to get started

You can enable Google Customer Reviews in the Merchant Center programs section, found under the 3-dot icon in your Merchant Center account. After you select Enable, follow the steps below to add the Google Customer Reviews program to your site. Learn more.

Once you have enabled your account and completed the enrollment steps, stats about your opt-in metrics, surveys, and seller rating will be available in your Google Customer Reviews dashboard in Merchant Center.


Integrating the survey opt-in

In the example below, we have added all required information to Google's opt-in code. You will need to replace the "MERCHANT_ID" variable with your Merchant Center ID. You can get this value from Google Merchant Center.

<!-- BEGIN GCR Opt-in Module Code -->
<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
          "merchant_id":"MERCHANT_ID",
          "order_id": "{{ order_name }}",
          "email": "{{ customer.email }}",
          "delivery_country": "{{ shipping_address.country_code }}",
          "estimated_delivery_date": "{{ order_date | date: "%s" | plus : 604800 | date: "%Y-%m-%d" }}",

          // OPTIONAL
          "opt_in_style": "CENTER_DIALOG",
          "products": [{% for item in line_items %}{"gtin":"{{ item.variant.barcode }}"}{% unless forloop.last %}, {% endunless %}{% endfor %}]
        }); 
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->

Badge Integration

Use the badge to display your participation in the Google Customer Reviews program as well as show your seller rating on your site.

To get started, add the code snippet below just before the </body> tag in your theme.liquid file, which can be found in your Theme Editor. After the code snippet has been added, verify the badge and attached text appear as expected on your site. Note: If there aren’t any seller ratings available, the message "no rating available" will appear.

You will need to replace the "MERCHANT_ID" variable with your Merchant Center ID. You can get this value from Google Merchant Center.

<!-- BEGIN GCR Badge Code -->
<script src="https://apis.google.com/js/platform.js?onload=renderBadge"
  async defer>
</script>

<script>
  window.renderBadge = function() {
    var ratingBadgeContainer = document.createElement("div");
      document.body.appendChild(ratingBadgeContainer);
      window.gapi.load('ratingbadge', function() {
        window.gapi.ratingbadge.render(
          ratingBadgeContainer, {
            // REQUIRED
            "merchant_id": MERCHANT_ID,
            // OPTIONAL
            "position": "BOTTOM_LEFT"
          });           
     });
  }
</script>
<!-- END GCR Badge Code -->