2016-11-14 37 views
0

我正在使用名爲「DuracellTomi的Google Tag Manager」的wordpress google標籤管理器插件。我啓用了電子商務選項。當我把一個測試訂單轉發到一個自定義的感謝頁面。在該謝謝頁我進入JavaScript控制檯模式,並在那裏,我輸入「數據層」,這是標籤管理器電子商務數據層

輸出:

enter image description here

我希望這樣的事情:

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; 
    } 
} 

回答

0

我解決了這個問題我自己。

該插件不會將數據層作爲自定義感謝頁面。

所以有2個選項。

  1. 您不使用自定義感謝頁面並使用默認頁面。一旦你完成了這個工作,你可以在開發者工具中進入你的js控制檯,並輸入「數據層」,你將得到想要的結果。

  2. 你使用這個插件自定義謝謝頁:https://wordpress.org/plugins/wc-custom-thank-you/

相關問題