【问题标题】:Pinterest conversion tracking tag for WooCommerce ordersWooCommerce 订单的 Pinterest 转化跟踪标签
【发布时间】:2017-09-12 08:29:56
【问题描述】:

我需要安装 Pinterest 转换标签以从 WooCommerce 订单中动态跟踪“价值”和“订单数量”。 Pinterest 标签有 2 个部分的 Javascript。第 1 部分是网站标题中的基本代码。第 2 部分是 Checkout 标头中的事件代码。

我认为第 2 部分必须在下面进行修改(需要更改 value 和 order_quantity 以从 WooCommerce 订单中提取):

<script>
pintrk('track', ' checkout ', {
    value: {{Enhanced Transaction Revenue}},
    order_quantity: {{item.quantity}}
  });
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src=" https://ct.pinterest.com/v3/?tid= 123456789 &event= checkout &noscript=1" /> </noscript>

Pinterest 转换标签指南在这里:https://help.pinterest.com/sites/help/files/pinterest_tag_instructions.pdf

我现在很绝望,所以任何帮助都将不胜感激......并奖励!

【问题讨论】:

    标签: javascript woocommerce pinterest event-tracking conversion-tracking


    【解决方案1】:

    把它放在你的functions.php中并改变Your_Tag_ID以匹配你从Pinterest获得的标签ID。

    add_action( 'woocommerce_thankyou', 'pinterest_tracking' );
    
    function pinterest_tracking( $order_id ) {
    
    // Lets grab the order
    $order = wc_get_order( $order_id );
    
    /**
     * Put your tracking code here
     * You can get the order total etc e.g. $order->get_total();
     */
    
    // This is the order total
    $order_total = $order->get_total();
    $order_quantity = $order->get_item_count();
    
    ?>
    
    <script>
        pintrk('track', 'checkout', {
            {
                value: '<?php echo $order_total ?>',
                order_quantity: '<?php echo $order_quantity ?>',
                currency: 'USD'
            }
        ]);
    </script>
    <noscript>
    <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=Your_Tag_ID&event=checkout&ed[value]=<?php echo $order_total ?>&ed[order_quantity]=<?php echo $order_quantity ?>&noscript=1"/>
    </noscript>
    <?php
    
    }
    

    这里有两个对我有帮助的链接:

    https://docs.woocommerce.com/document/custom-tracking-code-for-the-thanks-page/

    https://developers.pinterest.com/docs/ad-tools/conversion-tag/

    【讨论】:

    • 您忘记了包含散列数据的电子邮件。
    猜你喜欢
    • 2016-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-02
    • 2017-06-07
    • 2019-08-16
    相关资源
    最近更新 更多