Question

What I am trying to do is give companies an option to show their ads on my website, like how Facebook does. I have a user based website, so there are many different pages.

If I have to guess, it would go something like this.

Step 1. Company creates an Ad(with different payment options). Step 2. The Ad is added to a mysql table. Step 3. The Ads are shown across the website, depending on the algorithm.

Now I would need to know a more detail way of doing it. Are there any good resources I can study?

Was it helpful?

Solution

Well, you have multiple options. The easiest is to just use an existing ad-company like Google AdWords. Just just create an account there, embed their code in your site and you're finished.

The point is that creating your own ad-engine brings several problems:

  • You have to write the engine, including payment options, click tracking etc
  • and care about legal problems and contracts (a company may sue you for not displaying ads enough, caused by bug or misinterpretation etc)
  • Also you need to find someone who advertises at your site
  • AdBlocker

It's not impossible and embedding a static image won't bring to much problems, but for totally automating the engine you'll have to worry about all those problems, especially the legal ones. If you still want do this, look at 4chan's AdEngine:

  1. Let the advertiser upload an image and store it on your server, save the click or view count left in the db.
  2. When a site with ads is loaded, query the db for ads where count_left > 0 (order by random is an option, as it usually balances at many queries) and display the corresponding image. If your site has different categories, you may want to add a tag-clause or something. Also, set the view count down by one. If you intend to use click count, let the img's link point on your website and subtract the clickcount, but watch out that it isn't called multiple times by a single client to damage your customers (per-session or per-ip lock).

Hope this helps; I'd recommend you AdWords as it saves a lot of trouble and work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top