analytics-debugger / ga4mp

GA4MP
MIT License
40 stars 11 forks source link

Cannot convert undefined or null to object #16

Closed RodriSanchez1 closed 1 year ago

RodriSanchez1 commented 1 year ago

Hi! Thanks @thyngster for your work. Im working on a React app that is wrapped with Cordova to build an Electron app. The project its Cboard and the Cordova Cboard if you want to check it out . We want to set up analytics on the Electron app. I tested your library. On web is working perfecltly but on the Electron app im facing this issue:

image

I think the problem is in this line. The User Agent Data on Electron is: NavigatorUAData : { "brands": [], "mobile": false, "platform": "" }

And image

On the retrived object, doesnt have fullVersionList prop One solution can be add a comprobation before (Object.values(d.fullVersionList) || ....) something like (d.fullVersionList && Object.values(d.fullVersionList) || ....)

thyngster commented 1 year ago

yep, some browsers may not have full support for the client hints and the checks are not properly done on the code. I'm reviewing this.