【问题标题】:Tag manager e-commerce data layer标签管理器电子商务数据层
【发布时间】:2016-11-14 12:13:34
【问题描述】:

我正在使用用于 wordpress 的谷歌标签管理器插件,名为:“DuracellTomi 的谷歌标签管理器”。我启用了电子商务选项。当我下测试订单时,我会转发到自定义感谢页面。在那个感谢页面上,我进入 javascript 控制台模式,然后输入“dataLayer”,这就是

输出:

我期待的是这样的:

transactionId': '1234',
   'transactionAffiliation': 'Acme Clothing',
   'transactionTotal': 38.26,
   'transactionTax': 1.29,
   'transactionShipping': 5,
   'transactionProducts': [{
       'sku': 'DD44',
       'name': 'T-Shirt',
       'category': 'Apparel',
       'price': 11.99,
       'quantity': 1
   },{
       'sku': 'AA1243544',
       'name': 'Socks',
       'category': 'Apparel',
       'price': 9.99,
       'quantity': 2

我需要做什么才能获得所需的输出?\

编辑:

我的自定义感谢页面是这样设置的:

// Redirect custom thank you

add_action( 'woocommerce_thankyou', 'bbloomer_redirectcustom');

function bbloomer_redirectcustom( $order_id ){
    $order = new WC_Order( $order_id );

    $url = 'http://dexport.nl/bedankt';

    if ( $order->status != 'failed' ) {
        wp_redirect($url);
        exit;
    }
}

【问题讨论】:

    标签: wordpress plugins google-tag-manager


    【解决方案1】:

    我自己解决了这个问题。

    插件不会将数据层分配给自定义感谢页面。

    所以有两种选择。

    1. 您没有使用自定义感谢页面,而是使用默认页面。完成此操作后,您可以转到开发人员工具中的 js 控制台并输入“数据层”,您将获得所需的结果。

    2. 您将此插件用于自定义感谢页面:https://wordpress.org/plugins/wc-custom-thank-you/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      • 2018-01-15
      • 1970-01-01
      相关资源
      最近更新 更多