在Shopify自建站中添加Google客户评论功能,增加GMC排名

admin4年前网站运营817

在Shopify自建站中添加Google客户评论功能,增加GMC排名

// this code works(4 Oct 2018), it might need changes depending on if and when shopify or google changes their code)
// Paste this code carefully with in the script tags

window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {

    //this code gets all the UPC codes for products ordered, and adds them to product array
    //skip products fields it if you are not using global identifier, it also means that your review is not co-nthrelated back to products ordered

    var products = [
      {% for item in order.line_items %}
        {
          "gtin": {{ item.variant.barcode }}
        },

      {% endfor %}

      ];

      window.gapi.surveyoptin.render(

        {

          // REQUIRED FIELDS

          "merchant_id": 12345, //replace with your own google merchant id

          "order_id": "{{order.order_number}}",

          "email": "{{order.email}}",

          "delivery_country": "{{order.shipping_address.country_code}}",

          //this date dictates when review email would be sent if customer opt in, "plus:345600" is number of seconds for 4 days. Change the number of seconds to delivery time (432000 = 5 days, 604800 = 7 days).

          "estimated_delivery_date": "{{ order.created_at | date:'%s' | plus:345600 | date:'%F' }}",

          //optional: delete this line if you are skipping product GTIN

          "products": [{% for item in order.line_items %}{"gtin":"{{ item.variant.barcode }}"}{% unless forloop.last %}, {% endunless %}{% endfor %}]

          //optional: setting to where to display the dialog(prompt customer to opt in)

          "opt_in_style": "CENTER_DIALOG"

        });

  });

}


相关文章

FB的广告设置心得

FB的广告设置心得

创建的广告不会显示在主页里---所以需要长久功效的,建议选择原有的帖子做广告推广素材----创建的广告容易封号--估计是网站不符合fb的规则--比如售后或者shiping什么的绑定域名----在品牌安...

建议中国卖家放弃谷歌的GMC

原因有三不信任中国人,认为中国的独立站都是骗人的审核非常严格:99.9%的网站审核不通过要符合谷歌的要求,网站基本上重新做一遍...

报错"指定值无效"时这样解决

后台切换成用英文版----一般都能解决用表格上传或者合并listing  :---用表格肯定能解决原文链接:Link...

独立站怎么才能有订单?

要想获得订单,独立站需要做以下几件事:1.制定有效的营销策略:通过SEO、SEM、社交网络营销等方式,向目标客户推广独立站,提高曝光率。2.提升网站质量:建设符合用户体验的网站,改善产品、服务等页面,...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。