OK, here's how to do the weighing (at least how I did it):
First off, you create a DB table that contains the sites/pages that will
contain the banner campaigns.  For you, you should just create one entry in
the table for your primary site.  This row contains the columns ID
(auto-int), SiteName (varchar), Impressions(int).  The impressions field is
the important one because it will be the basis of the weighting.  You can
either set this to a static number based on what you believe to be the
average daily impressions of your site, or you could collect the impression
data in a seperate table and then update the site table with an average.
The second table is the Campaign table.  This will contain all of the
campaigns for your all sites.  The most basic columns should be ID
(auto-int), CampaignName (varchar), StartDate (date-time), EndDate
(date-time), Impressions (int), IsActive (bit), IsDefault (bit), Weight
(int).
The important ones here are the IsDefault, StartDate, EndDate and
Impressions.  Every campaign should have these.  Most ad campaigns run for
30 days, but that really depends on you.  If a ad customer buys 100,000
impressions for 30 days, you enter the appropriate start and end dates
along with the 100,000 impressions.  
The IsDefault bit is only set for the campaign that will take any remaining
impressions (such as your "Your add here" example). Upon inserting or
updating the table, you can either have CF or a trigger peform the
weighting.  
The basic weighting will use 100% as the maxium weight. The weighting will
be calculated by dividing the campaign's total impressions by the total
days for the run.  This will give you an average daily impression count. 
Then divide that number with the average daily impressions for the site,
and that is your weighting.  Add that to the weighting field.  Each time a
new campaign is added the "default" campaigns weight should be recalulated
to comprise the remaining impressions or weight for the site.
Now, when a user requests a banner, the winner is determined by first
creating a random number between 1 and 100.  Then assign a block of numbers
to each campaign based on it's weight (example: if you have 4 campaigns the
first will get numbers 1-25, the next 26-50 and so on).
Then you simply loop through the campaign query and determine the winner by
the random number and the weight.
<cfset Rand = RandRange(1,100)>
<cfset End = 0>
<cfloop query="GetAd">
        <cfset Start = End>
        <cfset End = Start + GetAd.Weight>
        <cfif (Rand GTE Start) AND (Rand LTE End)>
                  <!--- We have a winner --->
              </cfif>
</cfloop>

And that's it.
Hope that helps.

Chris Terrebonne

----------------------------------------------
Original Message
From: "Bob Hendren"<[EMAIL PROTECTED]>
Subject: RE: banner ad weighting....
Date: Wed, 12 Apr 2000 22:49:51 -0400

>I thought about this a couple of weeks ago as a two-stage issue.  First,
you
>could setup your weighting percentages and any leftover unused spaces. 
Then
>you could create a memory structure to hold the next n number of banners
>(100, 1000, 10K) and randomly populate that according to the weighting
>percentages.  This sounded good to me because you're dividing the load up -
>the serving of the banners is accomplished by walking through the memory
>array that is created and the randomizing of the banners is done
>periodically when that memory array runs out.  This was all in my head -
not
>actually put in practice yet!  Just opinion so far.  Let me know what you
>think.
>
>-------------------------
>Bob Hendren
>BrainKeepers
>E-Commerce - Internetworking - Information Systems
>404-375-2258
>[EMAIL PROTECTED]
>
>-----Original Message-----
>From: Tom Forbes [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, April 12, 2000 10:32 PM
>To: [EMAIL PROTECTED]
>Subject: Re: banner ad weighting....
>
>
>How about an array or look-up table. I did this successfully with a Monte
>Carlo simulation I wrote to address queing theory. Was that a dry project.
>
>Tom
>
>
>
>
>At 10:01 PM 4/12/00, you wrote:
>>Hello All,
>>
>>I plan to offer banner ads on our Fusioneers.com web site ASAP.  I don't
>>want to use any of the canned scripts from the developer's exchange for
>>various reasons that I don't want to dwell on here.
>>
>>The way the banner displays are going to work is this....
>>
>>All Fusioneers.com partners are entitled to a free banner ad on our
>>site.  People who pay a monthly fee will obviously be given a far greater
>>weighting factor than the freebies.
>>
>>So, our plan was to do something like the following:
>>
>>All freebie ads combined would account for 1% of the total weighting
>factor.
>>
>>We would then sell off weights in blocks of 10%, 20% and 30% of
>>impressions until the maximum of a 100% has been reached.  The unsold
>>weight blocks would display a "Your Ad Here" ad.
>>
>>So, in other words, when we display the ads, they will be called at
>>random, but I want the weights to affect their odds of being displayed.
>>
>>Hopefully this makes sense.  By the way, for the person who figures out
>>the best solution, we'll give you a 30% block of the 1st month's banner ad
>>weighting absolutely free as our way of saying thank you.
>>
>>---mark
>>
>>--------------------------------------------------------------
>>Mark Warrick
>>Phone: (714) 547-5386
>>Efax.com Fax: (801) 730-7289
>>Personal Email: [EMAIL PROTECTED]
>>Personal URL: http://www.warrick.net
>>Business Email: [EMAIL PROTECTED]
>>Business URL: http://www.fusioneers.com
>>ICQ: 346566
>>--------------------------------------------------------------
>>
>>--------------------------------------------------------------------------
-
>---
>>Archives: http://www.eGroups.com/list/cf-talk
>>To Unsubscribe visit
>>http://www.houseoffusion.com/index.cfm?sidebarsts&bodysts/cf_talk or send
>>a message to [EMAIL PROTECTED] with 'unsubscribe' in the
>body.
>
>Thomas J. Forbes
>Forbes Consulting
>
>TEL: 407-772-3427
>FAX: 407-772-3428
>
>http://www.medmatrix.com
>MedMatrix Medical Equipment Portal
>
>
>
>
>---------------------------------------------------------------------------
-
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to