Jump to content

Need recommendations for ad space management script


dflow

Recommended Posts

yeah i checked that out downloaded some demos to see what they offer

 

 

what i need is a system where i can track impressions and clicks per banner and  to rotate them accordingly while terminating a banner showing when he reaches xk impressions or clicks

 

in addition  to accumulate the data in a database  so ad space buyers can see reports of their media performance

i think what i'd do is this:

 

create  table in the DB called banners (or something similar) structured:

-bannerID - a SERIAL type column (unique int, auto increment, not null, primary key, in case you don't use mysql)

-ownerID - a unique id each ad owner receives so he can view ad statistics

-url - the url to which you redirect when the banner is clicked

-src - the path to the file that contains the banner (i assume most will be .swf files).

-totalViews - the total amount of times a banner was loaded into a page

-totalClicks - the total amount of times a banner was clicked

-maxViews - cap of impressions, after which you retire the banner

-maxClicks - cap of clicks, after which you retire the banner

 

you could also add (since i assume you will charge by the month, an ad-space buyers will want to ses this):

-monthlyViews - total views from the 1st of the month

-monthlyClicks - total clicks from the 1st of the month

 

for retired banners, you can either add an "active" boolean column, or create another, similar, table to which they will be moved. the second option will reduce the active banner table size, thuz shortening table lookup times, and probably lowering memory use.

 

from here, it kinda depends on how you decide which banners to show. for example:

 

1) if you just want to show the banner with the lowest totalViews (or lowest monthlyViews), you could probably get away with just send a "SELECT src FROM banners WHERE MIN(totalViews)"; and immediately after that send "UPDATE banners SET totalViews = (totalViews+1),  monthlyViews = (monthlyViews + 1) WHERE MIN(totalViews)";

for clicks, just update the relevant columns in the table when you detect a click (i assume all banners call a php script with the banner id appended to the url to be retrieved by $_GET[]).

 

2) if the decision of which banner to show is complex (or even if it isn't) you may want to save the table lookup every time a user requests a page by creating a script that will run, say, once an hour (use sleep() or schedule a task with the relevant php extension). this script will find the 3-5 banners that will be shown for then next hour, populate a simple table (banner id, src, url, clicks and views columns) and your pages will update this smaller table. the once-an-hour script will update values in the main table from the statistics collected over the last hour by the intermediate table, and only then re-calculate which banners will be shown over the next hour. this way, you use a small, simple table, so lookup time is shorter, memory use is lower. the down side of this is that you may pass the manViews or maxClicks value during the hour between updates, and that banner use will not be even (over the short term), but rather these 3-5 banners will have higher views (compared to other banners) after 1 hour, but very low views (compared to other banners) after a few hours. but since you change the used banners once an hour, this should not matter much, since in the longer run (24-36 hours) things will be even more or less.

 

i really hope this is the kind of post you wanted, otherwise i just wasted a whole lot of screen space in this thread ;D

Archived

This topic is now archived and is closed to further replies.

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