# Managing ads banner

**URL:** <https://discuss.rubyonrails.org/t/managing-ads-banner/40403>\
**Category:** rubyonrails-talk\
**Created:** [March 13, 2009, 4:37pm UTC](https://discuss.rubyonrails.org/t/managing-ads-banner/40403 "2009-03-13T16:37:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [March 13, 2009, 4:37pm UTC](https://discuss.rubyonrails.org/t/managing-ads-banner/40403/1 "2009-03-13T16:37:49Z")

</div>

Hi guys,

What is the best way to include ad banners in rails? Do you include them in default layout? What is the ideal way if the ad has to change each time?

Thanks,

---

<div class="post-metadata">

**Author:** ![Philip\_Hallstrom](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@Philip\_Hallstrom](https://discuss.rubyonrails.org/u/Philip_Hallstrom)\
**Post date:** [March 13, 2009, 5:34pm UTC](https://discuss.rubyonrails.org/t/managing-ads-banner/40403/2 "2009-03-13T17:34:52Z")

</div>

> What is the best way to include ad banners in rails? Do you include them in default layout? What is the ideal way if the ad has to change each time?

My advice would be to not to do it. Tie Rails into an existing ad server. You really don't want to have to write your own ad server if you can avoid it.

You may find this useful: [http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails](http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails)

I'm assuming you want to sell your own banners, otherwise integrating Google Adsense or similar is as simple as just dropping in the code.

-philip

---

<div class="post-metadata">

**Author:** ![Philip\_Hallstrom](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@Philip\_Hallstrom](https://discuss.rubyonrails.org/u/Philip_Hallstrom)\
**Post date:** [March 13, 2009, 6:54pm UTC](https://discuss.rubyonrails.org/t/managing-ads-banner/40403/3 "2009-03-13T18:54:36Z")

</div>

> Philip Hallstrom wrote:
> 
> > > What is the best way to include ad banners in rails? Do you include them in default layout? What is the ideal way if the ad has to change each time?
> > 
> > My advice would be to not to do it. Tie Rails into an existing ad server. You really don't want to have to write your own ad server if you can avoid it.
> > 
> > You may find this useful: [http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails](http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails)
> > 
> > I'm assuming you want to sell your own banners, otherwise integrating Google Adsense or similar is as simple as just dropping in the code.
> > 
> > -philip
> 
> Thank Philip.
> 
> I was actually investigating both options, making my own or using adsense.Can you please share some information (or links) on how to integrate Adsense in my code?

Just drop the code into your views...

If you want to make it a bit more configurable, setup a simple admin tool where your ad guy can paste the adsense code into a text\_area and then include that. Add some keys so in your view you'd do something like:

\<%= AdsenseCode.find\_by\_key("homepage\_bottom\_right") %\>

Or similar.

---

<div class="post-metadata">

**Author:** ![Asim](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Asim](https://discuss.rubyonrails.org/u/Asim)\
**Post date:** [April 9, 2009, 7:40pm UTC](https://discuss.rubyonrails.org/t/managing-ads-banner/40403/4 "2009-04-09T19:40:55Z")

</div>

On way to do this is as mentioned on this blog. I used it and it gave some simple steps to getting google ads up and running on my RoR application

> **[Google ad Sense code implementation with Ruby on Rails](http://atservice.blogspot.com/2008/07/google-ad-sense-code-implementation.html)**
>
> I needed to integrate Google Adsense with my Ruby On Rails application. It was quiet easy actually but initally it was somewhat time consmin...
