Search code examples
djangotheoryadsgoogle-ads-api

How to serve mixed static and dynamic ads from a database?


I'm building an application in Django that needs to integrate advertising into the site. I need to serve ads based on "ad priority" as determined by tho following:

  1. If the page "owner" has an ad that they have paid for in the system, serve that/those ad(s) first.
  2. If not, serve Google AdWords ads or some other type of ads in their place.

I'm somewhat new to working with ads in a dynamic site like this one, so what should I do? Obviously, all of this should be backed by a database, but how should I model it? It seems like there will be 3 types of ads: image/hyperlink custom ads, flash custom ads, and Google AdWords ads. Is this pretty accurate? Do I need to worry about XSS (cross-site-scripting) if I do this?

If you were me, how would you go about doing this in Django? I know it's somewhat subjective, but I'm pretty much in the dark and would love to hear some good ideas. It would be nice to simply go exclusively with Google AdWords or a similar service, but serving custom paid ads is pivotal in the business model.


Solution

  • I'd go with Google Ad Manager. You can serve custom campaigns, and if there're none, you can set it up to show AdSense.