Well, if you don't delay it, once the script is done processing, the browser will be forwarded to the destination. If there's no "delay" then the image may never be downloaded. If there's a slight delay, then it most likely will send the request for the image before it's told to move on.
One thing you could do is something like:
<?php
/* Let's touch the stat server */
$fh = fsockopen('http://www.trackingsite.com/cnt/a/12946/', 80, $error, $errno, 30);
if($fh) {
// We're connected, let's send some headers!!
$out = "GET / HTTP/1.0\r\n";
$out .= "Host: www.trackingsite.com\r\n";
$out .= "Connection: Close\r\n\r\n";
$html = '';
fwrite($fh, $out);
while(!feof($fh))
$html .= fread($fh, 1024);
}
$ipaddress=$_SERVER['REMOTE_ADDR'];
// blah blah...
if(!empty($product)) header('Location: '.$product);
But that's just another option of what you could do. Obviously it needs refinement, and checking to make sure that you get an HTTP header of 200 OK back.