so if they arrive to the site because they used a search engine (google, yahoo, ask...) you want to give a number but if they have the page bookmarked you want to give a different number, and if they come through yellowpages.com you want to give a third (different) number?
I would highly suggest against, this, but rather listing all the possible numbers in a section of the site
I say this because the "referer" or page that was previously visited before coming to the current one can easily be spoofed (tricked) into not being genuine. Also as i stated in my example, someone may come to the site via a search engine, then save it as a bookmark or as their "home page" in which case it wouldn't necessarily be the same referrer type as the original.
if you would like to go against my suggestion the best way to do this is through a server-side language like PHP, because using a client-side language such as Javascript, could be turned off, in which case you will not know what the referrer is even if it wasn't spoofed.
PHP Code:
$_SERVER['HTTP_REFERRER'];
will give you the previous page, and which case you can handle what to display from there using some type of validation / looping system.
Bookmarks