[SOLVED] How to Run a JavaScript Code at Browser Closing Time?

Error message

For a recent Drupal project there was a requirement to find the pages that a user visits on the site and send that to Google Analytics. Here, first we should save the page links that the user visits. But for this we need,