【问题标题】:How to implement Google Adwords conversion code in Contact Form 7 Wordpress如何在 Contact Form 7 Wordpress 中实现 Google Adwords 转换代码
【发布时间】:2018-04-27 00:17:11
【问题描述】:

我想在 Contact form 7 插件中集成 Google 转换 Adwords 代码,而不重定向到“谢谢”页面。如何在 Contact form 7 中实现 Google Adwords 转换代码> 插件。有人能帮帮我吗。我不想重定向到另一个页面。

【问题讨论】:

    标签: wordpress forms google-ads-api contact-form-7


    【解决方案1】:

    我在 Contact form 7 中找到了实现 Google 转换 Adwords 代码的解决方案。

    第 1 步 编辑您要跟踪其转化的 CF7 表单,并将来自 google 的 Google Adwords 转化代码粘贴到表单末尾。

    第 2 步

    将 on_sent_ok 替换为 DOM 事件。

    要使用 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”行并保存联系表单。

    【讨论】:

    • hi sarun.. 这种方法对您跟踪 adwords 的转化有效吗?不适合我...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 2020-04-09
    • 1970-01-01
    相关资源
    最近更新 更多