Google Customer Reviews

New Member
2 0 1

I would like to add Google Customer Reviews to my store without having to pay for an app or expert to do so.

Where do I paste this code in Shopify (I know I will have to add my Merchant ID) -

Source - https://gist.github.com/joe-dempsey/4ed55937b7292907e90eae05d830b2ff/revisions

+<code>
+{% if customer.default_address.country | json  == 'United Kingdom' %}
+{% comment %}
+Delivery may take up to 7 days in this case so we're doing date + 7 days and assigning it.
+{% endcomment %}
+{% assign seconds = 7 | times: 24 | times: 60 | times: 60 %}
+    <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": enter your merchant id here,
+          "order_id": "{{ order.id }}",
+          "email": "{{ customer.email }}",
+          "delivery_country": "GB",
+          "estimated_delivery_date": "{{ "now" | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}",
+          // OPTIONAL
+          "opt_in_style": "CENTRE_DIALOG"
+        }); 
+    });
+    }
+    </script>
+
+{% endif %}
+</code>

 

1 Like
New Member
2 0 1

Do I add a Templates, Snippets or Assets and call it shopify-reviews.liquid then paste the code above or do i go to admin/settings/checkout and paste it in additional scripts?

Also If I woulld like to display the badge on my store, I believe I can copy-and-paste the snippet before the closing </body> in my theme.liquid file. Replace XXXXXXXXX with your merchant ID:

<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, {"merchant_id": XXXXXXXXX});
    });
  }
  window.___gcfg = {
  lang: 'en_US'
};
</script>
0 Likes

Hi Simon,

See my guide to integrate Google Customer Reviews with Shopify. It has all the info there. The script you first mentioned needs to get on the thank you page while the badge goes in your theme.liquid file.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
0 Likes
Tourist
5 0 0

Hi Josh,

 

do you have any advice for integrating Google Reviews if I'm using Shopify with only "Buy Now" buttons rather than the shop? Can I still paste the above code in the additional scripts box in the checkout?

 

Cheers!

 

0 Likes
Highlighted

I haven't used it in the case of those who just have Buy Now buttons, but it should work for you as well because it's dependent only on the checkout.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
1 Like