如何在联系表格7 Wordpress中实施Google Adwords转换代码 [英] How to implement Google Adwords conversion code in Contact Form 7 Wordpress

查看:2182
本文介绍了如何在联系表格7 Wordpress中实施Google Adwords转换代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Google转换Adwords代码整合到联系表单7 插件中,而不会重定向到谢谢页面。如何在联系表单7中实施Google Adwords转换代码 Plugin.Could someone help me.I would not prefer redirectcting to another page。

解决方案

我找到了解决方案来实现Google转换Adwords代码联系表单7.

第1步
编辑您想跟踪转化的CF7表单并粘贴Google Adwords转化代码从您的表单的结尾处的谷歌。



第2步



替换on_sent_ok使用DOM事件。



要使用DOM事件替代代码,首先在活动主题的目录中找到名为functions.php的文件。其次,在functions.php文件的底部添加以下代码:

  add_action('wp_footer','mycustom_wp_footer') ; 

函数mycustom_wp_footer(){
?>
< script type =text / javascript>
document.addEventListener('wpcf7mailsent',function(event){
typeof goog_report_conversion ==='function'&& goog_report_conversion();
},false);
< / script>
<?php
}

第3步



从附加设置标签中删除on_sent_ok一行并保存联系表单。


I want to integrate Google conversion Adwords code in Contact form 7 Plugin without redirecting to a ‘Thank You’ page.How to implement Google Adwords conversion code in Contact form 7 Plugin.Could someone help me.I would not prefer redirecting to another page.

解决方案

I found solution for implementing Google conversion Adwords code in Contact form 7.

Step 1 Edit the CF7 form you want to track conversions for and paste the Google Adwords Conversion code from google at the end of your form.

Step 2

Replacing on_sent_ok with DOM Events.

To replace it with an alternative code using DOM events, first, find the file named "functions.php" in the directory of your active theme. Second, add the following code at the bottom of the functions.php file:

add_action( 'wp_footer', 'mycustom_wp_footer' );

function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailsent', function( event ) {
    typeof goog_report_conversion === 'function' && goog_report_conversion();
}, false );
</script>
<?php
}

Step 3

Remove the "on_sent_ok" line from the Additional Settings tab and save the contact form.

这篇关于如何在联系表格7 Wordpress中实施Google Adwords转换代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆