Hey everyone, I’m having a weird issue with Firebase Analytics. We’re trying to send e-commerce events like ITEM_VIEW, but we’re getting Error 21 in the console. It says something about the ‘items’ parameter not supporting arrays.
Here’s what we’re doing:
const event = {
productName: 'Cool Gadget',
price: 99.99,
category: 'Electronics',
items: [
{
productId: 'GADGET123',
name: 'Cool Gadget',
brand: 'TechBrand',
variant: 'Blue'
}
]
}
firebaseAnalytics.logEvent('PRODUCT_VIEW', event)
We’re using uppercase names for our events instead of the lowercase ones in the SDK. Could this be the problem?
Also, can custom events in Firebase have array parameters at all?
We’re using React Native with the invertase wrapper for Firebase, if that matters. Any help would be awesome!
yo grace, i’ve dealt with this before. firebase can be a pain sometimes! the uppercase thing is def ur problem. try switching to lowercase event names like ‘view_item’ instead of ‘PRODUCT_VIEW’. also, make sure ur event structure matches what firebase expects for ecommerce stuff. it’s picky bout that. good luck!
Hey Grace_42Read! 
Hmm, that’s a tricky one. I’ve run into similar issues before, and it can be super frustrating. Have you tried using the lowercase event names instead? Firebase can be pretty picky about these things sometimes.
Also, I’m curious - why are you using uppercase names? Is it for consistency with some other part of your system?
About the array parameter - I think Firebase has some specific requirements for e-commerce events. Maybe try restructuring your event object a bit? Something like:
const event = {
items: [{
item_name: 'Cool Gadget',
item_id: 'GADGET123',
price: 99.99,
item_brand: 'TechBrand',
item_category: 'Electronics',
item_variant: 'Blue'
}]
}
firebaseAnalytics.logEvent('view_item', event)
This follows Firebase’s recommended structure for e-commerce events. Give it a shot and let us know if it works!
By the way, are you using any other analytics platforms alongside Firebase? I’m always interested in hearing about different setups people are using.
I’ve encountered similar issues with Firebase Analytics. The problem likely stems from using uppercase event names. Firebase expects predefined e-commerce events to use lowercase names, such as ‘view_item’ instead of ‘PRODUCT_VIEW’.
Additionally, the structure of your event object doesn’t align with Firebase’s expectations for e-commerce events. Try restructuring it like this:
const event = {
currency: 'USD',
value: 99.99,
items: [{
item_id: 'GADGET123',
item_name: 'Cool Gadget',
item_brand: 'TechBrand',
item_category: 'Electronics',
item_variant: 'Blue',
price: 99.99
}]
}
firebaseAnalytics.logEvent('view_item', event)
This structure adheres to Firebase’s e-commerce event parameters. If you need custom events with array parameters, consider using a different analytics solution alongside Firebase for more flexibility.