将 Google 转换代码添加到 WordPress 联系表 7
我找到了将 Google 转换代码添加到 WordPress Contact Form 7 插件的教程,可以在 此处.
I found a tutorial for adding Google Conversion code to WordPress Contact Form 7 plugin which can be found here.
目前我已添加
<script type="text/javascript">
$(".wpcf7-form").submit(function(){
var google_conversion_id = "12345678910";
var google_conversion_label = "xxxxxxxxxxx";
var image = new Image(1,1);
image.src = "http://www.googleadservices.com/pagead/conversion/"+google_conversion_id+"/?label="+google_conversion_label+"&script=0";
});
</script>
到我的页脚,但它没有发送正确的结果.有人可以通过 WordPress 的控制面板帮助我解决我应该添加到我的联系表单插件中的内容,以使我的分析显示正确的结果.我不想重定向到另一个页面.
to my footer, but it doesn't send correct results. Could someone help me out with what I should add to my Contact Form Plugin, through the control panel of WordPress, to make my Analytics show correct results. I would not prefer redirecting to another page.
推荐答案
您走对了.当这个脚本运行时,你会在服务器上记录你的结果.
You are on right track. As this script runs you get your results recorded at server.
- 实现这一目标的最简单和最常见的方法是将单独页面上的脚本(通常是Thank-you.php)并重定向用户访问该页面,以便在完成他的活动后我们可以运行此脚本并记录此活动.或
- 另一种方式(虽然很棘手)是让这个脚本在用户活动后使用 ajax/javascript 的同一页面.
- The easiest and most common way to achieve this is to place the script on a separate page(generally a thank-you.php) and redirect user to that page so after completion of his activity we can run this script and record this activity. OR
- The other way(a tricky one though) is to make this script run on the same page using ajax/javascript after user's activity.
如果您想在没有任何重定向的情况下设置它,您可能会发现这很有帮助.
If you want to set it without any redirection you may find this helpful.
无需重定向的 Google 转化跟踪
相关文章