【问题标题】:Detect if Yes is selected on Google Customer Reviews Popup检测是否在 Google Customer Reviews Popup 中选择了 Yes
【发布时间】:2019-03-05 18:59:31
【问题描述】:

我在商店结账时设置了 Google 顾客评价,我正在尝试确定顾客是否选择来选择加入评价。我希望有一个 javascript 成功调用,但什么也没看到。有谁知道如何做到这一点?

这是谷歌代码:

<!-- 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(
        {
          "merchant_id": 42,
          "order_id": "<?php echo $order_id ?>",
          "email": "<?php echo $email_address ?>",
          "delivery_country": "<?php echo $user_country ?>",
          "estimated_delivery_date": "<?php echo $delivery_date ?>",
          "opt_in_style": "BOTTOM_LEFT_DIALOG"
        }); 
     });
  }
</script>
<!-- END GCR Opt-in Module Code -->

<!-- BEGIN GCR Language Code -->
<script>
  window.___gcfg = {
    lang: 'en_US'
  };
</script>
<!-- END GCR Language Code -->

【问题讨论】:

    标签: javascript magento google-api merchant-account


    【解决方案1】:

    也许你可以在用户点击按钮时听到事件。

    您应该只获取按钮的 id o 标识符,然后添加一些类似这样的代码行。

    document.addEventListener('click', (event) => {
      if (!event.target.matches('.google-button')) return 
    
       /* Put all you code here */
    })
    

    假设标识符是 .google-button 类。

    我希望这能给你一个想法。 问候!

    【讨论】:

      猜你喜欢
      • 2013-08-31
      • 1970-01-01
      • 2019-07-31
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 2015-08-19
      • 2012-01-07
      • 1970-01-01
      相关资源
      最近更新 更多