firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
820 stars 424 forks source link

Firebase Analytics: Event Parameter Requires "NSArray" but C# Parameter Class Doesn't Support NSArray #713

Open doom-goober opened 4 years ago

doom-goober commented 4 years ago

Please fill in the following fields:

Unity editor version: 2019.3.0f6 Firebase Unity SDK version: 6.12.0 Source you installed the SDK (.unitypackage or Unity Package Manager): .unitypackage Firebase plugins in use (Auth, Database, etc.): Auth, Analytics, Functions, Crashlytics Additional SDKs you are using (Facebook, AdMob, etc.): Facebook Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows Platform you are targeting (iOS, Android, and/or desktop): iOS, Android, WebGL Scripting Runtime (Mono, and/or IL2CPP): IL2CPP

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

Using Firebase Analytics, submit the event EventAddToCart with the parameter ParameterItems. Notice the Unity Documentation says ParameterItems should be of type (NSArray). Notice Parameter does not accept Arrays and only accepts string, long, and double.

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? No

What's the issue repro rate? (eg 100%, 1/5 etc) 100%

patm1987 commented 4 years ago

Thanks for the report!

doom-goober commented 4 years ago

To be extra clear, here's the analytics call in JavaScript:

firebase.analytics().logEvent("view_item", 
    { 
    currency: "someCurrencyName", 
    value: 12, 
    items: [{item_id: "someID"}]
    }
);

Notice in Javascript that the "items" event parameter is an array of Item objects. And here's the same call from Unity:

Parameter[] parameters = {
  new Parameter(FirebaseAnalytics.ParameterCurrency, "someCurrencyName"),
  new Parameter(FirebaseAnalytics.ParameterValue, 12),
  new Parameter(FirebaseAnalytics.ParameterItems, "") //How do you specify items?
};
FirebaseAnalytics.LogEvent("view_item", parameters);

Notice that in Unity it's impossible to specify the Item objects for the "items" event parameter. The Unity Parameter class only accepts: double, long, and string.

This means that a cross platform application running in both Unity and Javascript are incapable of logging identical analytics events. Unity is incapable of logging events that follow the Google Analytics specification.

Further: The documentation under the Unity Documentation for Event Parameters is written in Objective-C. For example: ParameterItems mentions "NSArray" and uses the Objective-C "@" operator. This appears to be a copy and paste error and further adds to confusion.

ishnu47 commented 3 years ago

Do you have any update or workaround for this? Thanks.

emaadgh commented 3 years ago

Any update on this?

BukerBear commented 2 years ago

well we really need this

sdalexandre commented 2 years ago

This is fundamental also to be able to implement the "begin_checkout" and "purchase" events

VolodymyrBS commented 2 years ago

is there any information regarding this? this issue is 2 years old and still no news 😢

ilsnk commented 1 year ago

well what is there?

ilsnk commented 1 year ago

@paulinon @patm1987 do you have any news about it? why is this taking so long to do under C#/Unity. Isn't that the priority you should be focusing on?

ilsnk commented 1 year ago

kill me, we are tired of waiting

JZechy commented 1 year ago

@paulinon @patm1987 So what are we supposed to do? What a basic thing yet not supported in Unity... That's unbelievable.

nindim commented 6 months ago

Just ran into this and there still doesn't seem to be anyway to do this in 2024...? :(

@patm1987 - Any chance this can be priortised somehow?

WitchK1ng commented 1 month ago

I'm also in need of this!