Tracking Banner Impressions by day

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Tracking Banner Impressions by day

Post by GeXus »

Hello, I want to write a script that will track impressions to a specific page load (which will contain a banner)...

I'm trying to determine the best way to do this. The way i see it being done is this...

1. Check the database for todays date, if it does not exist it will create a record with todays date
2. Everytime the page is loaded, it will get the count value from the database.
3. If the count is null it will set this value to 1
4. If the count is not null, it will simply add 1 to whatever value is returned.

Does that sound about right?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Create a table with an auto inc field, a date time field

Code: Select all

'INSERT INTO MYTABLE SET date_time_field = now()'

Sometime people like to track IP and browser type also...If so, just add an extra field or two for those items.

Then you can do a count with a group by date query.
Post Reply