22

I use Firebase Analytics and my app logs some events with this code:

Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "SOME_ID")
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "SOME_TYPE");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);

And it seem to work well most of the time. In logcat I have something like this:

Logging event (FE): select_content, Bundle[{_o=app, content_type=SOME_TYPE, item_id=SOME_ID}]

But for some events I receive

Logging event (FE): select_content, Bundle[{_o=app, _ev=item_id, _err=4, content_type=SOME_TYPE}]

Apparently, _err=4 is some kind of error code. What does it mean?

In that cases with error my item_id was a pretty long string (20-30 symbols). Maybe there is a limitation on the length of the item_id?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
user35603
  • 765
  • 2
  • 8
  • 24

4 Answers4

48

According to Official Documentation:

Param names can be up to 40 characters long, may only contain alphanumeric characters and underscores ("_"), and must start with an alphabetic character. Param values can be up to 100 characters long.

So, they have length constraints on both Key and Value.

Key: 40 characters long

Value: 100 characters long

Manish Karena
  • 724
  • 6
  • 29
Chintan Soni
  • 24,761
  • 25
  • 106
  • 174
  • Thanks for replay. – user35603 Jul 23 '16 at 09:07
  • 5
    How does Google expect developers to normalize all event values to less than 36 chars?? – Oded Regev Sep 25 '16 at 11:27
  • Not related to error code 4, but for error code 7 ("User property value is too long"): I was stripping the values of my user properties to 40 characters, but it turns out the actual limit is 36 characters as @OdedRegev mentioned. I tried shortening the property keys, but that had no effect. – Paul Lammertsma Jun 13 '17 at 14:58
  • If this is used for the Firebase+GTM SDK - you can use longer values for now – Dmitry Mar 29 '18 at 03:25
16

You are logging event with a parameter that exceeds the maximum value limit. There was accompanying FA/Error log message with more details that you probably missed.

Here is the list of the Firebase Analytics error codes:
1 - Invalid Firebase project id.
2 - Event name is invalid (empty, too long, invalid characters).
3 - Event parameter name is invalid (empty, too long, invalid characters).
4 - Event parameter value is too long.
5 - Event has more than 25 parameters.
6 - User property name is invalid (empty, too long, invalid characters).
7 - User property value is too long.
8 - App Instance logs more than 500 unique event types.
9 - App Instance sets more than 25 unique user properties.
10 - App Instance exceeds conversion event limit in a single day.
13 - Event name is reserved.
14 - Event parameter name is reserved.
15 - User property name is reserved.
11, 12, 16 - Internal error.

djabi
  • 5,601
  • 18
  • 25
2

Yes, They have a restriction on the length of the item_id. In my case as well while I was integrating it with my app, got the same errors when my item_id was long.

skynet
  • 706
  • 4
  • 8
0

Please refer to error code values in Official Google Docs. It clearly states that error 4 means "Event parameter value is too long". Hope this helps someone with different error code too.

Rahul Serodia
  • 419
  • 6
  • 13