near / near-wallet

Web wallet for NEAR Protocol which stores keys in browser's localStorage
https://wallet.near.org
MIT License
213 stars 176 forks source link

Minor bug fix on rudderstack #3118

Closed hcho112 closed 5 months ago

hcho112 commented 5 months ago

This PR contains two minor fixes:

  1. Only track if event label is present
  2. Let Rudderstack manage the when to send track event instead of explicitly checking rudderAnalyticsReady condition

Background: During the implementation of new events regards to near wallet sunset, I have encountered that some of the events weren't firing to rudderstack even if they have eventLabel present. After investigation, I remembered that there was a condition in place to check rudderstack initialize complete and only then send track events. Previously it was enough to cater for wallet migration implementation. However, on near sunset, we are tracking events that occur during visiting landing page + visiting unsupported page and redirect event. This is normally happening in the very early stage of the render and it wasn't sending events because rudderAnalyticsReady wasn't ready. Was planning to implement logic to wait until initialization is complete, but before going to it, I was experimenting that if rudderstack actually handles this type of situation internally where, many other analytics now actually store the events in buffer if track event actually happens before initialization completes. (And send the events after automatically) And luckily it handles internally so decided to remove unnecessary logic.