poorejc edited a comment on issue #50: URL: https://github.com/apache/incubator-flagon-useralejs/issues/50#issuecomment-801276755
document.addEventListener('visibilitychange', function () { if (document.visibilityState === 'hidden' && logs.length > 0) { navigator.sendBeacon(config.url, JSON.stringify(logs)); } }); this code does work to the desired behavior. below is JSON snip from log firing from "linked button" element, which also opens a new page. "useraleVersion": "2.1.1", "toolName": "Apache UserALE.js Example (Custom)", "sessionID": "session_1616003276152", "type": "click", "path": [ "button#Linked Button", "a", "body", "html", "#document", "Window" ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org