Not sure what you are trying to accomplish in yor last code.
OK, so heres my thought. Yahoo gets the referrer as sent by apache. And that is, index
So try this:
Remove the tracker from index.php
At the top of index.php put this in
PHP Code:
if ($_GET['tracker']==1){
include 'tracker.inc'
exit;
}
At the bottom:
PHP Code:
echo '<iframe src="'.$_SERVER['PHP_SELF'].'?tracker=1" style="width:0px;height:0px;display:none;"></iframe>';
Now, create a file called tracker.inc that looks like this with the tracker code:
The theory
index loads with $tracker set to NULL.
Top include is ignored.
Then it loads an invisible iframe, which loads index.php?tracker=1. So the Yahoo code loads in the iframe where the php extension is visible and it should get tracked.
In this way, you can load this on any page, or even in your header.inc and footer.inc and it is 100% recyclable.