Page 1 of 1

referer based urls

Posted: Fri Nov 10, 2006 6:48 am
by andycole
Hi there,

looking for help and advice one creating a Ad tracking page unlike many scripts already out there.

Here's the scenario we have multiple Google Adwords ads, in order to track which is getting most hits etc and working best we want to track it by using a variable in php which creates a unique URL that our Plesk system can see and track stats on, heres my example:
  • Advert1 on Google is directing traffic to .com/index.php?refer=advert1
    Advert2 on Google is directing traffic to .com/index.php?refer=advert2
This would then allow Plesk to see statistics for both adverts seperately, we do not mind where the google ad is shown to get an exact referer URL as such we merely wish to track which style of advert yields the most results.

I presume that somehow in our php page we would have a variable with different values i.e "Advert1" or "Advert2"

Any thoughts on this? I would greatly appreciate the help. It is important to realise the difference between this and using PHP's inbuilt HTTP_REFERER, which would not hold the answer for us.

Thanks!

Posted: Fri Nov 10, 2006 12:20 pm
by John Cartwright
What exactly are you having problems with? Are you looking for simply comments or suggestions?

I presume that somehow in our php page we would have a variable with different values i.e "Advert1" or "Advert2"

Code: Select all

$adverts = array('Advert1', 'Advert2');

if (!empty($_GET['refer']) && in_array($_GET['refer'], $adverts) 
{
   // .. ready to roll!
}
As you can see, ?refer= is accessible through $_GET['refer']