【问题标题】:Error in Integrate Google Adwords conversion code in Contact Form 7 Wordpress在联系表 7 Wordpress 中集成 Google Adwords 转换代码时出错
【发布时间】:2017-06-14 05:07:16
【问题描述】:

我想在 Contact form 7 插件中集成 Google 转换代码。我已经设置了一切。 但提交表单时出错。

Uncaught ReferenceError: ga is not defined

at eval (eval at <anonymous> (scripts.js?ver=4.8:256), <anonymous>:1:1)
at String.<anonymous> (scripts.js?ver=4.8:256)
at Function.each (jquery.min.js:2)
at ajaxSuccess (scripts.js?ver=4.8:256)
at Object.<anonymous> (scripts.js?ver=4.8:324)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
at XMLHttpRequest.<anonymous> (jquery.min.js:4)

联系表格 7 A 附加设置如下

【问题讨论】:

    标签: php wordpress forms google-ads-api contact-form-7


    【解决方案1】:

    将其他设置替换为on_sent_ok: "typeof goog_report_conversion === 'function' &amp;&amp; goog_report_conversion();"

    并将 Google Adword 转换代码原样放在表单底部。

    【讨论】:

      【解决方案2】:

      on_sent_okon_submit 已弃用,计划于 2017 年底废除。

      您可以使用DOM-events 代替这些设置。

      你可以使用这个功能

      <script type="text/javascript">
      document.addEventListener('wpcf7mailsent', function( event ) {
      var img = document.createElement("img");
      var goalId = "868xxxxxx"; // Your Google Conversion ID
      var randomNum = new Date().getMilliseconds();
      var value = 0;
      var label = "WoZxxxxxxxxxx"; // Your Google Conversion Label
      var url = encodeURI(location.href);
      var trackUrl = "http://www.googleadservices.com/pagead/conversion/"+goalId+"/?random="+randomNum+"&value="+value+"&label="+label+"&guid=ON&script=0&url="+url;
      img.src = trackUrl;
      document.body.appendChild(img);
      }, false ); 
      </script>
      

      【讨论】:

        猜你喜欢
        • 2013-09-28
        • 2018-04-27
        • 1970-01-01
        • 2013-06-19
        • 2018-10-01
        • 1970-01-01
        • 2013-10-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多