Google跟踪代码管理器数据层变量未定义-Woocommerce

时间:2018-09-18 06:38:04

标签: wordpress woocommerce google-tag-manager google-datalayer

我在使用名为ecomm_totalvalue的Google跟踪代码管理器处理未定义的数据层变量时遇到了麻烦(请注意,我也尝试过object.ecomm_totalvalue

我正在将WordPress / WooCommerce和GTM与duracelltomi-google-tag-manager一起使用来创建和访问数据层。

数据层正常工作,并且使用GTM检查器/预览版,我可以查看所有DLVariable(参见图1),但是当我在Google跟踪代码管理器中创建数据层变量并尝试将其记录到日志时,它们显示为未定义具有GTM标签的控制台。

由于变量存在,我不确定我在做什么错,我认为我没有正确调用它们!

任何帮助将不胜感激,请查看图像以获取更多信息。

谢谢!

图片1-GTM预览

enter image description here

图片2-数据层变量

enter image description here

图片3-标签

enter image description here


(6) [Arguments(2), Arguments(2), {…}, {…}, {…}, {…}, object_observed: true, push: ƒ] 0: Arguments(2) ["js", Sun Sep 23 2018 17:54:21 GMT-0700 (Pacific Daylight Time), callee: ƒ, Symbol(Symbol.iterator): ƒ] 1: Arguments(2) ["config", "UA-01234567-1", callee: ƒ, Symbol(Symbol.iterator): ƒ] 2: customerBillingAddress1: "" customerBillingAddress2: "" customerBillingCity: "" customerBillingCompany: "" customerBillingCountry: "" customerBillingEmail: "" customerBillingFirstName: "" customerBillingLastName: "" customerBillingPhone: "" customerBillingPostcode: "" customerFirstName: "" customerLastName: "" customerShippingAddress1: "" customerShippingAddress2: "" customerShippingCity: "" customerShippingCompany: "" customerShippingCountry: "" customerShippingFirstName: "" customerShippingLastName: "" customerShippingPostcode: "" customerTotalOrderValue: "0.00" customerTotalOrders: 0 ecomm_pagetype: "other" pagePostAuthor: "user" pagePostType: "page" pagePostType2: "single-page" __proto__: Object

1 个答案:

答案 0 :(得分:0)

只需在数据层变量中使用ecomm_totalvalue,并确保在数据层变量可用后即可触发代码。无需在自定义HTML标签中测试变量,您可以在预览面板中看到该值。