quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

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

Open doom-goober opened this issue 4 years ago • 13 comments

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%

doom-goober avatar Jun 16 '20 17:06 doom-goober

Thanks for the report!

patm1987 avatar Jun 18 '20 22:06 patm1987

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.

doom-goober avatar Jun 23 '20 22:06 doom-goober

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

ishnu47 avatar Nov 11 '20 17:11 ishnu47

Any update on this?

emaadgh avatar Nov 22 '20 07:11 emaadgh

well we really need this

BukerBear avatar Mar 18 '22 05:03 BukerBear

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

sdalexandre avatar Jun 13 '22 15:06 sdalexandre

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

VolodymyrBS avatar Jun 16 '22 13:06 VolodymyrBS

well what is there?

ilsnk avatar Nov 18 '22 14:11 ilsnk

@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 avatar Nov 18 '22 14:11 ilsnk

kill me, we are tired of waiting

ilsnk avatar Feb 06 '23 15:02 ilsnk

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

JZechy avatar Apr 26 '23 08:04 JZechy

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?

nindim avatar Jan 06 '24 16:01 nindim