Skip to Main Content
Optimizely Data Platform
Workspace Integrations
Created by Guest
Created on Jun 27, 2023

react-sdk does not have a method to flush queue without closing tabs

the only way to flush the event batching queue is to close the instance. This is way too rudimentary and inflexible for power users. Please let us in on low level api on when and how to flush the queue.

also consider to adjusting use `pagehide` in your code

> On the browser side, optimizely.close() is automatically connected to the pagehide event, so there is no need to do any manual instrumentation.

> Like the unload and beforeunload events, this event is not reliably fired by browsers, especially on mobile. For example, the pagehide event is not fired at all in the following scenario:
> https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event




  • Attach files
  • Guest
    Reply
    |
    Jun 27, 2023

    I would like to be able to flush events on "visibilitychange" https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState, for that I need something else than optimizelyInstance.close() since I still want the instance to be kept alive.

    Something like optimizelyInstance.flushEventQueue() would leave us greater freedom to use event batching and also maintain control.

  • Guest
    Reply
    |
    Jun 27, 2023

    s/tabs/instance/