snowplow / snowplow-javascript-tracker

Snowplow event tracker for client-side and server-side JavaScript. Add analytics to your websites, web apps and servers.
http://snowplowanalytics.com
BSD 3-Clause "New" or "Revised" License
555 stars 222 forks source link

@snowplow/browser-tracker | missing outQueue collector url #1283

Open ghost opened 10 months ago

ghost commented 10 months ago

Description We encounter error logs when executing "disableAnonymousTracking()" alongside an out-queue in local storage containing items; before any event is sent and therefore bloat the monitoring system with error logs and also loose events from the out-queue.

To Reproduce

  1. The collector has anonymousTracking disabled and therefore set to false; stateStorageStrategy is set to "cookieAndLocalStorage"
  2. Make sure that disableAnonymousTracking() gets immediately executed before any new event is triggered (e.g. in an effect when using react)
  3. Open the page/app, start a session and make sure that events land in the local storage out-queue when e.g. leaving the page.
  4. Return and open the page/app again with an out-queue containing items to be processed; disableAnonymousTracking()will get called as in step 2) | make sure that no event has been sent before
  5. Now the events in the out-queue which are start being processed are failing because there is no collector url defined

Expected behavior I would either expect more documentation on the behavior or pitfalls of executing the disableAnonymousTracking() function; or that the events within the out-queue are somehow correctly1) processed.

1) It's hard for me to say at this point what exactly that might be.

Screenshots none

Desktop (please complete the following information):

Additional context We could also configure the tracker correctly in the first place, and not call disableAnonymousTracking() when anonymousTracking is already disabled. Either way, it should not interfere in this case, as this will prevent pending events from the out-queue from being processed successfully.

I am aware that the steps to reproduce are kept quite minimal; but may be sufficient. Please do not hesitate to let me know if you need any additional info or context.

ghost commented 10 months ago

Duplicates: https://github.com/snowplow/snowplow-javascript-tracker/issues/1221