Thursday, December 4, 2014

More thoughts about the ad-server.

The adserver as written is a rather simple piece of code. The information needed for each add is stored in an array of javascript objects and randomly selected to update the contents of a named<div> tag.

That's fine for a small number of adds, but not suitable for a larger group. It's also relatively fragile as one typo will kill the whole add. There are two options:
  1. Use some central repository, such as a file on google drive, to hold a configuration file. Read it on loading and run the adds from it. 
  2. Write a program to write the program. It reads a configuration file and its output can be simply included by hand, or from a central location. (i.e. a web reference).
Most add-servers use some variant of the first option. That way they can keep track of adds served and click-throughs (both of are charged to the advertiser). The headache for a free service is that it costs to maintain such a service. The second approach may have slightly higher initial load times (bigger scripts), but would run without a mandatory central server.