Re: [PHP] Dear Lazy Web: Pseudo Randomisation Strategies on Listing Websites
At 10:00 AM +0100 8/20/10, Colin Guthrie wrote: Are there any other approaches I've missed? Is there some cunning, cleverness that eludes me? Col Col: I don't know about being clever, but the problem reminds me of selling ad space on web sites. I read a book about it, namely "OpenX Ad Server" by Yilmaz It provided a lot of back-end considerations for displaying ads, such as: 1. How to randomly preference some ads over others. To give preference to gold over silver by simply having more gold ads than silver ads in the collection of ads to pick a random selection. For example, if you have twenty gold ads and ten silver and randomly pick, then gold has a a 2:1 advantage even though the pick is random. 2. What time of day show ads per location of user -- you see, each time zone has it's own "busy" time and ads shown during those times are at an advantage. For example your web site may be showing one set of ads for CA, another for MO, and another for MI all at the same local time. 3. And other such considerations -- it might be worth the cost to purchase and review. They did a pretty in-depth study of how to track and optimize ad sales. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dear Lazy Web: Pseudo Randomisation Strategies on Listing Websites
Hi Col, Interesting problem. > Are there any other approaches I've missed? Off the top of my head, how about this: 1. Add a new unsigned int column called "SortOrder" to the table of widgets or whatever it is you're listing 2. Fill this column with randomly-generated numbers between 0 and whatever the unsigned int max is (can't remember exactly but 4.2 billion ish) 3. Add the SortOrder column to the end of all your ORDER BY clauses - SELECT foo ORDER BY TypeOfListing, SortOrder will give you widgets sorted by Gold/Silver/Bronze type, but in a random order for each type 4. Every hour/day/week/whatever, update this column with different random numbers Advantages: practically no hassle/overhead/maintenance for you; provides same ordering sequence for all users at the same time; only breaks "third one down"-type references when you refresh the SortOrder column rather than on each session or page view; reasonably proxy- and cache-friendly especially if you send a meaningful HTTP Expires header. Disadvantages: breaks user persistence if they visit before and after a SortOrder refresh ("I'm sure the one I wanted was at the top of the list yesterday..."); more effort to demonstrate randomness to the client ("OK, see how you're in ninety-third place today? Well, check again tomorrow and you should be somewhere else on the list"). Hopefully food for thought anyway. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php