Shopify添加Google Review代码

Settings——Checkout——additional scripts:

{% if first_time_accessed %}
<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(
        {
          "merchant_id": 137100730,
          "order_id": "{{ order.name }}",
          "email": "{{ order.email }}",
          "delivery_country": "{{ shipping_address.country_code }}",
          "estimated_delivery_date": "{{ order.created_at | date:'%s' | plus:1209600 | date:'%F' }}",
          "products": [{% for item in order.line_items %}{"gtin":"{{ item.variant.barcode }}"}{% unless forloop.last %}, {% endunless %}{% endfor %}]
        });
    });
  }
</script>
{% endif %}

发表评论

电子邮件地址不会被公开。 必填项已用*标注