donni106 / matomo-tracker-react-native

Stand alone library for using Matomo tracking in React Native and Expo projects.
MIT License
47 stars 15 forks source link

offline support #22

Open angelxmoreno opened 1 year ago

angelxmoreno commented 1 year ago

Is your feature request related to a problem? Please describe. Looks like the Android and IOS sdks have it: https://matomo.org/faq/general/will-matomo-track-users-when-the-web-app-or-mobile-app-is-offline-no-internet/

Describe the solution you'd like

  1. The request objects would be stored in a queue.
  2. The lib would send out the requests in bulk

Describe alternatives you've considered none

Additional context

  1. see the Advanced Users: Send multiple API Requests at once section in https://developer.matomo.org/api-reference/reporting-api
  2. Will Matomo track users when the web app or mobile app is offline (no internet)?
donni106 commented 1 year ago

Thanks for the request. I can agree to having a queue with tracking objects to send once a device gets online could be a big step forward.

angelxmoreno commented 11 months ago

Digging deeper into this I found a few "concerns":

  1. Matomo throws an exception for all requests older than 24 hours - https://github.com/matomo-org/matomo-sdk-ios/pull/301#issuecomment-512974671
  2. The IOS SDK suffers from this as well
  3. Prior to implementing offline support we should implement a Queuing system with batch requests. The Queue system should start with a MemoryStorage object that implements an interface ( something like QueueStorage ). This way, users can optionally pass w/e storage mechanism they want. This QueueStorage would be enhanced to do offline work