Any idea on how it's done?
I tried to recreate it with the following scenario:
First, we have ref.php
Loading this script will simply display "none".
ref.php
Code:
<?php
if (isset($_SERVER['HTTP_REFERER'])) echo $_SERVER['HTTP_REFERER'];
else echo 'none';
?>
If we link to it with link.php, ref.php to display "link.php" as the referring site.
link.php
Code:
<a href="ref.php">link</a>
iframe.php places ref.php in an iframe. If we load iframe.php directly we will see "none" as the referer to iframe.php, and "iframe.php" as the referer to ref.php.
iframe.php
Code:
<?php
if (isset($_SERVER['HTTP_REFERER'])) echo $_SERVER['HTTP_REFERER'];
else echo 'none';
?>
<br />
<iframe src="ref.php" width="400" height="100"></iframe>
Now if we change link.php to link to iframe.php instead of ref.php, we will see "link.php" as the referer to iframe.php, but ref.php will keep detecting "iframe.php" as the referer. It will not detect link.php. The attachment shows the output.
link.php
Code:
<?php ?><a href="iframe.php">link</a>
So in essance, link.php is the site that sends you traffic, iframe.php is your site, and ref.php is the google ad. In the above example, there is no way for ref.php to find out about link.php.
So how does google do it? It has access to the same headers as everyone else does.