When I tried to add Admob to my mobile site a few days ago, I discovered that Google/Admob’s ruby gem only works with Ruby 1.8.7 and Rails 2. Considering that Rails3 is was released earlier this year, it was surprising that the gem had not been updated. Anyways, as its open-source, I was able to get the code from rubyforge and make the required changes.
The new gem is called ‘admod19′ and can be installed easily by typing
gem install admob19. If you would like to get the source, its on github at https://github.com/anuaimi/admob19
For those that wand the technical details of the changes that I made, here is a list of what was updated.
- how session ID was accessed.
session.session_idwas changed to
- updated MD5 calls to use new module name. MD5 is now Digest::MD5
- strip off any rack or rails headers in the request that is sent to Admob
Final note, follow the instruction in the gem’s README.txt file rather than what’s up on Admob’s site and you should be up and running quickly. Oh, and Admob is not returning ads, it’s possible they have no inventory. Easiest way to test that is to add an in-house add and have Admob use that whenever they don’t have an ad to server.