We have a button on our website. Clicking on this button will send users to an external page (a page with a different domain) in the same tab. We want to register click event on this button.
My code is something like this:
const handleClick = () => {
track(EVENT_NAME)
window.location.href = EXTERNAL_URL
}
In this case, we are not seeing the event on amplitude.
I am assuming this is because we are navigating away from website before amplitude has enough time to send the event.
We tried adding `await` to the amplitude `track` event which works but it is resulting in a slight delay which is not a good user experience.
Does anyone have any solution for this? This looks like a common use case.