OpenX is an opensource adserver with similar functionality to other ad services. The difference is that you run the service yourself and it is free if you host it yourself.
I am often faced with Drupal clients who are interested in selling ad space on their sites but don't want to use a paid service, need more flexibility than the ad module available for Drupal, and don't want want to use a service like AdBrite or Google Ads.
This little tutorial will show you how to install the ad server on your localhost to play around with it. First off, you need some kind of *amp stack on your computer. I personally work on a Mac, so I use MAMP. This also means that the tutorial is Mac centric.
- Download the OpenX package here: http://www.openx.org/download
- Change the permissions on the openx/var folder, as well as the openx/www/images folder - they need to be writable. The easiest way to this is to right click on the directories in question choose "Get Info". From there, unlock the little lock icon at the bottom of the screen, you will need to enter your admin username and password.
- Fire up MAMP and click on "Open Start Page"
- Click on phpMyAdmin in the menu bar at the top of the page
- Click on the "databases" link in the main body of the page
- At the bottom of this page is a text box that reads "create new database", type in a name for your new database and choose a "collation", I used UTF8
- Create a user for the database--click on the sql tab up top and use the following command "grant all on database_name.* to user_name@localhost identified by 'password';" with no quotes and replacing database_name with the database, user_name with any name you care to put in, and password with an password you care to use
- Navigate to the OpenX directory. In my case, this redirects me to: http://localhost:8888/openx/www/admin/install.php
- Click Continue to go to the terms
- Click on "Agree" at the bottom of the page.
- OpenX will then check your system to make sure there are no issues. If all goes well there won't be any errors. Scroll to the bottom and click on "Continue"
- Enter in your username, password, and database for the MySQL database that you just set up. Click Continue. An OpenX database will be created at this point. Click "Continue"
- On the configuration page, touch nothing. Click "Continue"
- Create an Admin Account and click "Continue"
- OpenX will then install plugins. Once that is finished, click "Continue"
- At this point you are done. Click "Continue"
Your ad server is up and running. The next steps that I took were to set up one campaign with one ad that would live in a Drupal block.
- Click on "Add Advertiser"
- Enter your Advertiser Information
- Click on "Add Campaign"
- For this exercise, choose a "Remnant" campaign. You don't really need to choose any options at this point. Click "Continue"
- Click on "Add Banner"
- Enter the name, add the image, destination, target, alt text, status, text below the image, keywords, weight, and comments. Click "Save Changes"
- Click on the "Websites" link.
- Add a website to advertise on.
- Add a zone.
- Enter the name, description, category, zone type, size, and a comment.
- Add a "Targeting Channel"
- Choose "Direct Selection" and make selections there (don't enter anything in banner selection")- click refresh. It will give you a new banner code. Copy it.
- For the purpose of this exercise, go to your Drupal instance and go to the blocks menu admin/build/block/add and add a new block.
- Paste the ad code into the block body.
- Save the block and activate it. You should be displaying an ad at this point in that block.