Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.