Firebase Analytics - sending nested object as event log
GFean opened this issue · 1 comments
Hi there, I'm using firebase analytics for my app. The goal I'm trying to achieve is to log several informations about the user, which are located in different DTOs. For example if user clicks removeProductFromCart
button, I want to log which product that was and this is another DTO, if user clicks clearCart
, I want to log the list of the objects that were contained in the cart before..
I hope I explained it in an understandable way. So the result must look something like this :
analytics().logEvent('remove_from_cart', {product: {id: 123, name:"test" ...} userInfo: {id: 123, userName: "test" ...} })
But when I do following, it seems to be working - since it doesn't give any errors, but it appears as firebase_error 21 in firebase console. Is this approach not supported ? does any other approach exist for achieving the same goal ?
Thanks in advance !
According to the doc, firebase_error 21 looks like the error code indicating Event does not support array parameters
. So if you get this error, I guess that field does not support the type you set.
Maybe you can use items field to store items in the cart? It accepts Array.
https://developers.google.com/gtagjs/reference/event#parameters_19