1 Replies - 1629 Views - Last Post: 13 August 2011 - 03:03 AM Rate Topic: -----

#1 glen75  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 02-August 11

How to count unique impressions by IP ?

Posted 13 August 2011 - 01:49 AM

Hi,

I have CPM banner that count some visitor's impression but i can't count it by unique IP address :

index.php :

include "http://domain.com/goldtracker.php?user=3";


goldtracker.php :

<?php
    include "connection.php";	
	$ip      = $_SERVER['REMOTE_ADDR'];
	$tanggal = date("Ymd");
	$waktu   = time();
	$idads   = rand(1,3);
	
	$advertisement = mysql_query("SELECT * FROM goldavertisement WHERE id_ads='$idads'");
	
	mysql_query("UPDATE golduser SET validimp = validimp + 1, online = '$waktu' WHERE id_user='".$_GET['user']."'");
	$banner = mysql_fetch_array($advertisement);
	
	echo "<a href='http://$banner[url]'><img src='images/$banner[image]'></a>";
?>


how to count the unique traffic/impressions by IP address ?...the database structure is quite complex

Is This A Good Question/Topic? 0
  • +

Replies To: How to count unique impressions by IP ?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: How to count unique impressions by IP ?

Posted 13 August 2011 - 03:03 AM

You've already got golduser which I assume tracks clicks when they are logged in, right?

So all you need is a goldip of sorts, which is keyed with both the IP Address AND Advertisement name, and simply increment the count.

A table like this should do fine:
CREATE TABLE goldip (
    id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ip VARCHAR(20) NOT NULL,
    Advertisement_id INT(11) NOT NULL,
    impression_count INT(11) NOT NULL DEFAULT 0
);

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1