So there is this problem where one set the event to fired as an onClick handler on a regular link, there will be a problem in at least most popular Chrome browser, which will cancel requests send from the page you just navigated away from with a reasoning being: you as user might not need or care for resources requested by the page you just left.
Here is what documentation says about it:
Link-click tracking
The Optimizely Feature Experimentation JavaScript SDK does not use localStorage and consequently doe snot maintain a queue of pendingEvents (which Optimizely Web Experimentation does automatically). This means the browser will likely cancel a number of link-click tracking calls as users are being redirected.
A possible solution is to pass a parameter to the subsequent page URL and fire an event on that page.
Suggested solution is not applicable if the link leads to a website you dont have ownership over. Please provide solution on how to handle this. Maybe a code snippet we ask another website owner to add to their website.
Its possible to detect cancelled requests with AbortController and add retry functionality to "dispatchEvent". Sdk users should not be hold responsible to implement retry every time they have to integrate with Optimizely. Sdk users can implement retry itself, we cannot ensure retried events are the single unique event in case more than one retried event have gone through, that needs to be implemented on the optimizely backend server.
Please add retry functionality to dispatch event to incorporate handling of cancelled requests.
https://github.com/optimizely/javascript-sdk/issues/759
there is a better suggestion on github https://feedback.optimizely.com/ideas/ODPI-I-22