I built something like this awhile back. What I did was create a script called go.php and called that with a url=www.123.com parameter. When go.php loaded it quickly sent out a header("Location: " $url); command and then continued to log the site.
<?php
header("Location: " $url);
flush();
// Code to save the url the user went to.
?>
By using the Location header the user wasn't delayed very long, and there browser was able to go get the new page without waiting for my code to finish.