【问题标题】:Google Tag Manager Data Layer Variable undefined - WoocommerceGoogle 跟踪代码管理器数据层变量未定义 - Woocommerce
【发布时间】:2023-03-19 03:55:02
【问题描述】:

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

我正在使用带有duracelltomi-google-tag-manager 的 WordPress/WooCommerce 和 GTM 来创建和访问数据层。

数据层工作正常,使用 GTM 检查器/预览我可以查看所有 DLVariables(见图 1),但是,当我在 Google 跟踪代码管理器中创建数据层变量并尝试将它们记录到带有 GTM 标签的控制台。

由于变量存在,我不确定我在这里做错了什么,我假设我没有正确调用它们!

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

谢谢!

图片 1 - GTM 预览

图 2 - 数据层变量

图 3 - 标记


(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

【问题讨论】:

  • 投反对票:(苛刻
  • 能否更新数据层的完整列表?
  • 嘿@M.Kooi,这就是你需要的^更新Q
  • 为什么这被否决了?这是一个包含大量信息的好问题?

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-20
    相关资源
    最近更新 更多