Single pixel gifs for tracking

Status
Not open for further replies.

Jon12345

New member
Sep 14, 2006
187
0
0
Brighton, UK
I have a page on a merchants site where I want to put a link to single pixel gif so that I can track when a sale is made. My site - which will contain the gif - is on a site where I use php/mysql, with mysql storing the 'hit'.

Anyone got a simple example of what the link might look like and the code on the gif page? I gotta get my tracking sorted pronto!

Jon
 


<img src="http://url.com/something/productId/keyword/trafficsource/">

and then just a simple insert?
 
So do you refer to an actual page or just the graphic? The example you gave...seems to refer to just a directory? Yeah dumb questions but that's cause I'm dumb at this!
 
So do you refer to an actual page or just the graphic? The example you gave...seems to refer to just a directory? Yeah dumb questions but that's cause I'm dumb at this!

You could of course just pass the variables directly, instead of rewriting the url: <img src="http://url.com/track.php?product=1&source=7search&keyword=buy+this+product">

You're free to drop the source & keyword variable obviously, but I personally would track them as well. Then on track.php you just populate your table. lerchmo's way of doing this would work also, but unless you specify any of the variable you want to track in the checkout url, you are going to have a hard time tracking any useful data. But then again, it depends on what exactly you want to track, if it's just to record if and when a sale happened, then you would obviously just work with the referrer.
 
That is exactly right. I am having trouble working out what to put on the page the link refers to.

e.g. <img src="http://www.yoursite.com/track.php">

On page track.php, I can put the code in there to update my database. But if that was all there was, it would be fine. But as I understand it, the link is supposed to be to an image (single pixel gif). So what am I supposed to do regarding this?
 
That is exactly right. I am having trouble working out what to put on the page the link refers to.

e.g. <img src="http://www.yoursite.com/track.php">

On page track.php, I can put the code in there to update my database. But if that was all there was, it would be fine. But as I understand it, the link is supposed to be to an image (single pixel gif). So what am I supposed to do regarding this?
So you do the obvious thing: output a single-pixel GIF from track.php.

php-gd is your friend.
 
Or if you don't have the gd_lib installed/activated, just create one manually and output the header to the browser.
 
Status
Not open for further replies.