how to track from where visitor come to my site php
<p>I want to track the site URL from where user reached my site.<br>
From where he came i.el, Google, GMail, Facebook, etc.</p>

<p>I tried <code>$_SERVER['HTTP_REFERER']</code> but it does not contain anything when user click on my site link from any external site but resides the value when I visit among my site pages and <strong>this is also not trusted</strong>.</p>

<p>So, What I can do from here?</p>

<p>Is there any other way to track the external URL through PHP?</p>

<p>Any idea?</p>

<p><strong>EDIT:</strong> Now HTTP_REFERER is able to get the url from most of sites but not able to get the url if user came through <code>Gmail and AOL</code>. What could be the causes?</p>
