0

I am trying to understand how Google Tag Manager matches variables to fields in the objects pushed to the dataLayer. When it's a top level field, it is straightforward. However, how does one do matching when I want to push something like this:

dataLayer.push({
  'subcontainer': {
    'variable': true
  }
}

Would I match subcontainer.variable (which seems like the obvious way)? I couldn't find documentation for this, maybe someone could point me to something that explains this.

4

2 回答 2

0

如果我选择“。”的第 2 版。分辨率,它将其视为访问子对象,因此 subcontainer.variable 将适用于我的示例。

于 2016-08-03T01:33:52.077 回答
0

您必须创建一个 dataLayer 变量,其值将是 subcontainer.variable 并且版本将是 2 在版本 2 点(。)访问嵌套值。根据普通 JavaScript 规则,推送到名称中带有点的数据层的值将被解释为嵌套值。

您可以在此处找到更多相关信息 https://support.google.com/tagmanager/answer/6106899?rd=1#web

于 2016-08-03T06:37:48.737 回答