谷歌AdWords转化跟踪与AJAX表单

15

我有一个谷歌AdWords转化跟踪代码,需要基本上在单击事件上实现。 我正在使用AJAX提交信息的表单进行跟踪,然后通过替换表单的div元素为感谢HTML来向页面呈现感谢信息($('div').html("thank you....., etc");)

我想知道是否有一种方法可以在单击“提交”按钮时触发转化跟踪(a),或者如果我在写入到div的html()函数中包含要发布到网站的google脚本,那么它会跟踪转化吗?(b)或者其他任何关于如何做到这一点的想法?

我已经对此进行了一些搜索,但没有找到太多有用的信息... 谢谢!


你能提供一下追踪代码的样例吗? - Yahel
1
https://dev59.com/YF4d5IYBdhLWcg3wHPg9#27149886?noredirect=1#comment42795611_27149886\ - Imnotapotato
4个回答

6

5
据我所知,在您的范围内实现最佳方法是使用无脚本图像。 我将向您展示两种方式:
  1. You can put it on your "thank you HTML" as is, with escaped characters where necesary.

  2. Or... Just put an empty image tag like this anywhere on your HTML document:

    <img src="" width="1" height="1" style="visibility:hidden;" alt="" id="myconversion" />
    

    Then add this line of jQuery to your script before or after the your "thank you HTML":

    $("#myconversion").attr("src","xxxxxxxxx");
    

    Where xxxxxxxxx is the src attribute of the no-script image.


1

1
@Kethatril- 你从哪里听说 iframe 方法不可靠,为什么? - Yarin

0
尝试在用户转化后动态插入跟踪代码到页面中。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接