简体   繁体   English

如何在 firebase 分析自定义事件中将对象数组作为参数传递

[英]How to pass array of objects as parameter in firebase analytics custom events

We are trying to capture the API details on our website.我们正试图在我们的网站上捕获 API 的详细信息。 So we are logging a custom event inside the Axios interceptors.所以我们在 Axios 拦截器中记录了一个自定义事件。 So we need to send a nested object(which contains all the details of the API call) as a parameter in the custom_events.所以我们需要发送一个嵌套对象(其中包含 API 调用的所有详细信息)作为 custom_events 中的参数。 But when I am sending it firebase is not accepting.但是当我发送它时 firebase 不接受。 So I think firebase only accepts it in the form of items parameter.所以我认为 firebase 只接受 items 参数的形式。 But when I am using the items param(parcelable item) it is not showing it in the debug view.但是当我使用 items param(parcelable item) 时,它没有在调试视图中显示它。 Is there any way we can send our own custom object inside a single parameter in custom Events有什么办法可以在自定义事件的单个参数内发送我们自己的自定义 object

logEvent(
  analytics,
  'studio_metrics',
  {
    items: [{
      name: 'Kittens',
      age: 10
    }, {
      name: 'prabhakar',
      age: 12
    }]
  }
)

I am adding like this but it didn't work.我是这样添加的,但没有用。 If I am sending it via a predefined event like 'purchase' it is working fine.如果我通过“购买”等预定义事件发送它,它工作正常。 I am using react here.我在这里使用反应。

The items array has a special processing method and it is not possible to pass array parameters to custom events. items数组有特殊的处理方式,不能给自定义事件传递数组参数。 This will only work for Enhanced E-commerce events such as purchase.这仅适用于增强型电子商务事件,例如购买。 You could check this for more details on recommended E-commerce events of Firebase. Firebase的推荐电商活动详情可以查看这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM