gpt4 book ai didi

angular - 在GTM中发送数组对象

转载 作者:行者123 更新时间:2023-12-03 17:29:48 25 4
gpt4 key购买 nike

我在Google Analytics(分析)中有3个维度和1个指标,我是在Google标记管理器的帮助下填充这些维度的,其中我创建了一个在特定事件中执行的标记。

直到我发送单个对象之前,这一切都很好

(<any>window).dataLayer.push({
AgentEmail: 'bbj@gmail.com',
AgentLocation: 'Delhi',
AgentName: 'Agent0007',
AgentCount: '100',
event: 'agentInfo'
});


但是当我尝试发送数组对象时,我无法做同样的事情,即如果我想发送两个代理的信息,那么它仅保存单个信息

  (<any>window).dataLayer.push({
AgentEmail: 'z@gmail.com',
AgentLocation: 'Delhi',
AgentName: 'Agent0007',
AgentCount: '100',
event: 'agentInfo'
},({
'AgentEmail': 'z@gmail.com',
'AgentLocation': 'Delhi',
'AgentName': 'Agent0008',
'AgentCount': '100',
'event': 'agentInfo'
});


即使我尝试创建两个单独的数据层对象,并尝试以不同的方式发送这两个对象,但这也不起作用。

能否请您帮忙在GTM标签/变量和前端进行哪些更改以填充数据层。

最佳答案

您的对象之间有一个额外的括号“(”)。

dataLayer.push({
AgentEmail: 'z@gmail.com',
AgentLocation: 'Delhi',
AgentName: 'Agent0007',
AgentCount: '100',
event: 'agentInfo'
},{ //here you need to remove the "("
'AgentEmail': 'z@gmail.com',
'AgentLocation': 'Delhi',
'AgentName': 'Agent0008',
'AgentCount': '100',
'event': 'agentInfo'
});

关于angular - 在GTM中发送数组对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50445745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com