hansemannn / titanium-firebase-analytics

Use the Firebase Analytics SDK in Axway Titanium 🚀
Other
35 stars 18 forks source link

Custom Event Log #15

Closed maronaquillo closed 6 years ago

maronaquillo commented 6 years ago

I added a custom event log on my app but it seems that it logs as error on firebase event. Please guide us what's the correct way to add custom event. Thanks

Module platform: iOS
Module version:  1.1.0
Ti SDK version:  7.0.2.GA

Here's my sample code:

Alloy.Globals.FirebaseAnalytics = require('firebase.analytics');
Alloy.Globals.FirebaseAnalytics.configure();

Alloy.Globals.FirebaseAnalytics.log('click', {category: 'Main', action: 'Main-feed'});
hansemannn commented 6 years ago

Please always add your environment to new issues, at least:

maronaquillo commented 6 years ago

@hansemannn Sorry, I just updated my post with my environment.

hansemannn commented 6 years ago

It may be one of two issues: 1) You call configure too late and it didn't finish initializing before you log an event. In that case, please the configure() call at the first possible position in your app. 2) Your parameters are malformed. See the official code docs for details on valid keys and values:

/// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or
///     underscores. The name must start with an alphabetic character. Some event names are
///     reserved. See FIREventNames.h for the list of reserved event names. The "firebase_",
///     "google_", and "ga_" prefixes are reserved and should not be used. Note that event names are
///     case-sensitive and that logging two events whose names differ only in case will result in
///     two distinct events.
/// @param parameters The dictionary of event parameters. Passing nil indicates that the event has
///     no parameters. Parameter names can be up to 40 characters long and must start with an
///     alphabetic character and contain only alphanumeric characters and underscores. Only NSString
///     and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are
///     supported. NSString parameter values can be up to 100 characters long. The "firebase_",
///     "google_", and "ga_" prefixes are reserved and should not be used for parameter names.
maronaquillo commented 6 years ago

@hansemannn Thanks. The error on my code was the action parameter.