Glam Prestige Journal

Bright entertainment trends with youth appeal.

The page makes about 40 navigator.sendBeacon() calls to the same endpoint during and before rendering of the body, but sometimes a number of them result in a failed request with timing as "stalled".

I think I need to refactor the code and maybe queue the stringified objects and call sendBeacon() at a less busier timing, but I have no idea how

Thanks in advance!

The called function is

const fireAway = obj => { obj.hostname = _domain obj.referrer = _referrer obj.isMobile = _isMobile navigator.sendBeacon(_endpoint, JSON.stringify(obj))
}
2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy