页面在Google Adwords转化跟踪上被重定向

Gij*_*ese 1 javascript ajax google-adwords vue.js vue-resource

我已经形成了人们提交数据的地方,然后使用ajax将数据发送到服务器。我已将其设置为Google Adwords中的转换。下面是我使用的代码。

问题是,当用户提交表单时,在获得响应后,其重定向回我给出的URL。我不想重定向!

(由于此项目在VueJS中,因此提交的数据使用Vue资源)

submit() {
  let self = this
  this.$validator.validateAll().then(success => {
    if (!success) {
      return;
    }
    document.getElementById("submitQuote").value = "Submitting...";
    this.$http.post(store.state.url+'api/submit_quote.php', {
        formData: store.state.formData
      })
      .then(response => {
        console.log(response.data)
        this.submitted = true
        self.reference_id = response.data
        goog_report_conversion('https://www.example.com/') //report Google that a conversion has occured
      });
  });
}
Run Code Online (Sandbox Code Playgroud)

Google提供的代码

<!-- Google Code for Add to Cart Conversion Page
    In your html page, add the snippet and call goog_report_conversion
    when someone clicks on the chosen link or button. -->
    <script type="text/javascript">
     /* <![CDATA[ */
    goog_snippet_vars = function() {
      var w = window;
      w.google_conversion_id = 12345678;
      w.google_conversion_label = "abcDeFGHIJklmN0PQ";
      w.google_conversion_value = 13.00;
      w.google_conversion_currency = "USD";
      w.google_remarketing_only = false;
    }
    // DO NOT CHANGE THE CODE BELOW.
    goog_report_conversion = function(url) {
      goog_snippet_vars();
      window.google_conversion_format = "3";
      var opt = new Object();
      opt.onload_callback = function() {
      if (typeof(url) != 'undefined') {
        window.location = url;
      }
    }
    var conv_handler = window['google_trackConversion'];
    if (typeof(conv_handler) == 'function') {
      conv_handler(opt);
      }
        }
    /* ]]> */
    </script>
    <script type="text/javascript"
    src="//www.googleadservices.com/pagead/conversion_async.js">
    </script>??????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)

dor*_*ian 5

只是不提供指向的重定向URL goog_report_conversion,即在不带参数的情况下调用它。

重定向是有条件的:

if (typeof(url) != 'undefined') {
    window.location = url;
}
Run Code Online (Sandbox Code Playgroud)

  • 如果您在不带参数的情况下调用goog_report_conversion(),adwords是否可以获取进行转换的页面的网址? (2认同)