Re: Tracking impressions
| From: | Miguel Cruz | Date: | Sun, 31 Mar 2002 02:28:43 +0000 |
| Subject: | Re: Tracking impressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-90847@lists.php.net to get a copy of this message | ||
On Sat, 30 Mar 2002, David Duong wrote:
> Hello, I need a script that can track impressions through PHP.
>
> I know you load a php script from <IMG> tags than some how the image is
> loaded or redirected.
>
> Is their a way I can record impressions and environment variables like IP,
> Browser, referrer, etc.
Sure, it's all available to your PHP script.
counter.php:
<?
header('Content-Type: image/gif');
readfile('/path/to/my/graphic.gif');
// now save $HTTP_USER_AGENT, $REMOTE_ADDR, etc., in your database
?>
And just insert this on your page:
<img src="counter.php/anything.gif">
It doesn't matter what you put for "anything.gif" as long as it looks like
an image file.
miguel