我想将 Google 转化 Adwords 代码集成到联系表单 7 插件中,而不重定向到“谢谢”页面。如何在联系表单 7中实现 Google Adwords 转化 插件。有人可以帮助我吗。我不喜欢重定向到另一个页面。
最佳答案
我找到了在联系表单 7 中实现 Google 转化 AdWords 代码的解决方案。
第 1 步 编辑您想要跟踪转化的 CF7 表单,并将来自 google 的 Google AdWords 转化代码粘贴到表单末尾。
第 2 步
用 DOM 事件替换 on_sent_ok。
要将其替换为使用 DOM 事件的替代代码,首先,在事件主题的目录中找到名为“functions.php”的文件。其次,在functions.php文件底部添加以下代码:
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
}
第3步
从“其他设置”选项卡中删除“on_sent_ok”行并保存联系表单。
关于wordpress - 如何在Contact Form 7 WordPress中实现Google Adwords转换代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47279181/