I’ve just written a plugin to show ads (HTML code) to site visitors (as sidebar widgets) based on which country they’re in.
From the US? ==> You get the US ad
From the UK? ==> You get the UK ad
From Australia? ==> You get the AU ad
It’s been possible to do this using “Who Sees Ads” (or WSA) except that WSA doesn’t work when you’ve got caching turned on. The WSA logic is all written in PHP.
Anyone want to test it and/or look at my code?
I’m not a great coder, so I may be making some mistakes…
1. There is an “Ads by Country” options page where you put in your ads (your HTML Code). That code gets saved into the WP database (wp_options table).
2. Should I create a different entry in the DB for each country, or combine all this into one array?
3. Should I implement some kind of simple caching? Right now, every time the user loads the page, it uses the WP “get_option” function to pull the ad code from the DB. I’m thinking each user only needs to pull that from the DB once.
4. Does it need some error checks?
Above all, I’m trying to reduce the impact on the server by being smart about using the DB.