Is there a way to force amplitude-js to flush events? I’m trying to track an event that triggers a browser refresh, but the logEvent calls just prior to the reload are lost... This is true even if I move the browser refresh into the callback provided to logEvent.
Force flush?

Best answer by Denis Holmes
Hi
I believe with the JS SDK you can use the method amplitude.getInstance().sendEvents() to send any events early. There is some documentation available here for that. Is this what you were looking for? Let me know if it is not and I can ask our Engineers internally.
Kind Regards.,
Denis
Reply
Welcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. You can also create a Guest account below!
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comWelcome to the Amplitude Community!
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. Want to sign up as a guest? Create a Community account.
If you're a current customer, select the domain you use to sign in with Amplitude.
analytics.amplitude.com analytics.eu.amplitude.comEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.