1

Whenever I am using the VALUE param for passing events in Firebase Analytics, an additional event for ECOMMERCE_PURCHASE, is automatically logged.

Any suggestions on the what could be causing this issue?

UPDATE: The code associated with sending the event is as below:

FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(context);
Bundle bundle = new Bundle();
bundle.putLong(FirebaseAnalytics.Param.QUANTITY, 1);
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, categoryId);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, productName);
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, productId);
bundle.putString(FirebaseAnalytics.Param.ITEM_LOCATION_ID, productLocationId);
bundle.putDouble(FirebaseAnalytics.Param.VALUE, productPrice);
bundle.putString(FirebaseAnalytics.Param.CURRENCY, "INR");
bundle.putDouble(FirebaseAnalytics.Param.PRICE, productMRP);
bundle.putString(CUSTOM_PARAM, stringValue);
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, bundle);

The logs corresponding to the issue as pasted below. As per the logs, the event ecommerce_purchase is logged even though the passed event is add_to_cart. Also add_to_cart is never logged & uploaded by the SDK, only the ecommerce_purchase is uploaded which was never fired to begin with.

05-01 23:29:08.261 13862-17157/com.app.packagename D/FA: Passing event to registered event handler (FE): add_to_cart, Bundle[{item_name=Daawat Super Basmati Rice, quantity=1, item_location_id=16773036, price=150.0, value=150.0, item_category=1164, currency=INR, item_id=26}]
05-01 23:29:08.282 13862-17157/com.app.packagename D/FA: Logging event (FE): ecommerce_purchase, Bundle[{item_name=Daawat Super Basmati Rice, quantity=1.0, item_location_id=16773036, _o=app+gtm, _sc=xxxxxxx, _si=4306584406462471371, price=150.0, value=150.0, item_category=1164, currency=INR, transaction_id=150.0, item_id=26}]
05-01 23:29:08.295 13862-17157/com.app.packagename V/FA: Using measurement service
05-01 23:29:08.295 13862-17157/com.app.packagename V/FA: Connecting to remote service
05-01 23:29:08.474 13862-17157/com.app.packagename D/FA: Connected to remote service
05-01 23:29:08.475 13862-17157/com.app.packagename V/FA: Processing queued up service tasks: 1
05-01 23:29:08.493 16363-17166/? V/FA-SVC: Logging event: origin=app+gtm,name=ecommerce_purchase,params=Bundle[mParcelledData.dataSize=540]
05-01 23:29:08.516 16363-17166/? V/FA-SVC: Saving event, name, data size: ecommerce_purchase, 291
05-01 23:29:08.516 16363-17166/? V/FA-SVC: Event recorded: Event{appId='com.app.packagename', name='ecommerce_purchase', params=Bundle[{item_name=Daawat Super Basmati Rice, quantity=1.0, item_location_id=16773036, _o=app+gtm, _r=1, _sc=xxxxxxx, _si=4306584406462471371, _dbg=1, price=150.0, value=150.0, item_category=1164, currency=INR, transaction_id=150.0, item_id=26}]}
05-01 23:29:08.518 16363-17166/? V/FA-SVC: Upload scheduled in approximately ms: 500
05-01 23:29:08.526 16363-17166/? V/FA-SVC: Background event processing time, ms: 33
05-01 23:29:09.027 16363-16363/? V/FA-SVC: Device receiver got: com.google.android.gms.measurement.UPLOAD
05-01 23:29:09.035 16363-16363/? V/FA-SVC: Device PackageMeasurementService is starting up
05-01 23:29:09.035 16363-16363/? V/FA-SVC: Device PackageMeasurementService called. startId, action: 1, com.google.android.gms.measurement.UPLOAD
05-01 23:29:09.043 16363-17166/? V/FA-SVC: Evaluating filter. audience, filter, event: 2, 0, ecommerce_purchase
05-01 23:29:09.043 16363-17166/? V/FA-SVC: Filter definition: 
                                           event_filter {
                                             filter_id: 0
                                             event_name: ecommerce_purchase
                                             event_count_filter {
                                               comparison_type: EQUAL
                                               comparison_value: 1
                                             }
                                             filters {
                                             }
                                           }
05-01 23:29:09.044 16363-17166/? V/FA-SVC: Event filter result: false
05-01 23:29:09.044 16363-17166/? V/FA-SVC: Evaluating filter. audience, filter, event: 3, 0, ecommerce_purchase
05-01 23:29:09.044 16363-17166/? V/FA-SVC: Filter definition: 
                                           event_filter {
                                             filter_id: 0
                                             event_name: ecommerce_purchase
                                             event_count_filter {
                                               comparison_type: EQUAL
                                               comparison_value: 2
                                             }
                                             filters {
                                             }
                                           }
05-01 23:29:09.045 16363-17166/? V/FA-SVC: Event filter result: false
05-01 23:29:09.050 16363-17166/? V/FA-SVC: Saving bundle, size: 605
05-01 23:29:09.063 16363-17166/? D/FA-SVC: Uploading events. Elapsed time since last upload attempt (ms): 520
05-01 23:29:09.067 16363-17166/? V/FA-SVC: Uploading data. app, uncompressed size, data: com.app.packagename, 701, 
                                           batch {
                                             bundle {
                                               protocol_version: 1
                                               platform: android
                                               gmp_version: 10084
                                               uploading_gmp_version: 10298
                                               config_version: xxxxx
                                               gmp_app_id: xxxxx:android:xxxxx
                                               app_id: com.app.packagename
                                               app_version: 3.2.1-A
                                               app_version_major: 123
                                               firebase_instance_id: xxxxx
                                               dev_cert_hash: -5701045842766466506
                                               app_store: manual_install
                                               upload_timestamp_millis: 1493695749038
                                               start_timestamp_millis: 1493695748257
                                               end_timestamp_millis: 1493695748257
                                               previous_bundle_start_timestamp_millis: 1493695667931
                                               previous_bundle_end_timestamp_millis: 1493695667931
                                               app_instance_id: 4ced0047ca42b3fa88ff294910e9546d
                                               resettable_device_id: 4ffb0e11-3cf6-4de5-8e3b-e3741424c630
                                               limited_ad_tracking: false
                                               os_version: 7.0
                                               device_model: Nexus 6
                                               user_default_language: en-us
                                               time_zone_offset_minutes: -240
                                               bundle_sequential_index: 43
                                               service_upload: true
                                               user_property {
                                                 set_timestamp_millis: 1493633846756
                                                 name: _fot
                                                 int_value: 1493636400000
                                               }
                                               user_property {
                                                 set_timestamp_millis: 1493695748504
                                                 name: _ltv_INR
                                                 int_value: 1650000000
                                               }
                                               audience_membership {
                                                 audience_id: 2
                                                 new_audience: true
                                                 current_data {
                                                   results: 
                                                   status: 1
                                                 }
                                               }
                                               audience_membership {
                                                 audience_id: 3
                                                 new_audience: true
                                                 current_data {
                                                   results: 
                                                   status: 1
                                                 }
                                               }
                                               event {
                                                 name: ecommerce_purchase
                                                 timestamp_millis: 1493695748257
                                                 previous_timestamp_millis: 1493639625256
                                                 param {
                                                   name: item_name
                                                   string_value: Daawat Super Basmati Rice
                                                 }
                                                 param {
                                                   name: quantity
                                                   double_value: 1.0
                                                 }
                                                 param {
                                                   name: item_location_id
                                                   string_value: 16773036
                                                 }
                                                 param {
                                                   name: _o
                                                   string_value: app+gtm
                                                 }
                                                 param {
                                                   name: _r
                                                   int_value: 1
                                                 }
                                                 param {
                                                   name: _sc
                                                   string_value: xxxxxxx
                                                 }
                                                 param {
                                                   name: _si
                                                   int_value: 4306584406462471371
                                                 }
                                                 param {
                                                   name: _dbg
                                                   int_value: 1
                                                 }
                                                 param {
                                                   name: price
                                                   double_value: 150.0
                                                 }
                                                 param {
                                                   name: value
                                                   double_value: 150.0
                                                 }
                                                 param {
                                                   name: item_category
                                                   string_value: 1164
                                                 }
                                                 param {
                                                   name: currency
                                                   string_value: INR
                                                 }
                                                 param {
                                                   name: transaction_id
                                                   double_value: 150.0
                                                 }
                                                 param {
                                                   name: item_id
                                                   string_value: 26
                                                 }
                                               }
                                             }
                                           }
Vaibhav Singhal
  • 888
  • 9
  • 13

1 Answers1

0

I think I understand the problem. What you are seeing is two parts of the event logging process on a Play device. Messages that are tagged with "FA" are being written by the SDK from within your app. Messages that are tagged with "FA-SVC" are being written by Play Services. What you are seeing is the same event first being reported as logged by your app, then being reported as logged by Play Services. It's not two separate events, it's just the same event being handed off from one part of the software to another. If you're concerned about duplicate events, look further down in your logs where the events are actually uploaded, and I think you'll see that only one ecommerce_purchase event is being updloaded.

Dan Morenus
  • 1,068
  • 8
  • 12
  • I have updated the logs which show eccomerce_purchase being logged even though add_to_cart was passed. – Vaibhav Singhal May 01 '17 at 10:33
  • Can you extend your log excerpt to include the part where the events are actually uploaded? It should start with "Uploading data. app, uncompressed size, data" and include the uploaded events. Also, your param name "Is Device ID New" is invalid; maybe try "Is_Device_ID_New". – Dan Morenus May 01 '17 at 21:47
  • I have updated the logs, and from what I can gather, the only event recorded and uploaded, when add_to_cart is fired, is the ecommerce_purchase. Very odd issue. – Vaibhav Singhal May 02 '17 at 03:44
  • The origin on that ecommerce_purchase event is GTM. I would guess that you have trigger set up in Google Tag Manager that fires an ecommerce_purchase event whenever you log a value param on an event. – Dan Morenus May 02 '17 at 17:21
  • Quick followup, any reason ADD_TO_CART isn't being logged.? – Vaibhav Singhal May 02 '17 at 20:20
  • Since you're using GTM to filter your events it all depends on how your filters are set up. They can replace the original event with the new event depending on how they're configured. – Dan Morenus May 02 '17 at 22:26
  • One other follow-up. Do please check the event and param names on your custom events and make sure you're only using letters, numbers, and underscores in your names. In particular don't include spaces in the names. Events and params with invalid names won't get reported. – Dan Morenus May 03 '17 at 17:03