Adding Google Conversion code to WordPress Contact Form 7(将 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 = "aHR0cDovL3d3dy5nb29nbGVhZHNlcnZpY2VzLmNvbS9wYWdlYWQvY29udmVyc2lvbi8="+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 转化跟踪
这篇关于将 Google 转换代码添加到 WordPress 联系表 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Google 转换代码添加到 WordPress 联系表 7


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- PHP - if 语句中的倒序 2021-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01