Jump to content

Log url link throughs to file


giraffemedia

Recommended Posts

Hello

 

this is my first post and i'm a newbie so please bear with me.

 

I'm putting an advert onto my company website and the client has requested to know the amount of traffic the advert attracts (a click through).

 

How can I incorporate php to log all click throughs to a file on the server for the client?

 

Can I use something like this?  http://www.dynamicdrive.com/forums/archive/index.php/t-5341.html

 

Thanks in advance.

 

James

Link to comment
https://forums.phpfreaks.com/topic/75797-log-url-link-throughs-to-file/
Share on other sites

yes a similar kind of thing.

You basically need to store the data in a database.

Have the url in the advert as something like:

http://www.mydomain.com/ads.php?id=123

 

where the id is the id stored in the database corresponding to the advert.

Then on ads.php you need to read the $_GET['id'] info. check that it exists in the database. If so forward onto the advertised site.

 

BEFORE your forward them, you need to check the referrer ($_SERVER['HTTP_REFERER']), i'd suggest ip (to track unique hits) and a timestamp. Then store this in the database.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.