I''m working on a Rails 2.0 app... we''re getting read to use AdWords to drive some traffic... we plan to use a custom URL per ad (to allow us to track conversions on Google Analytics). The site is an ecommerce site. The plan is to route the adds to the same today page (and then track through to conversion or not). So I''d like ad-1 to use the URL www.foobar.com/ad1, ad-2 to use www.foobar.com/ad2, and so on. Where all the /adX url''s point to www.foobar.com which is the welcome page. I know that routes.rb is the way to go but wondering what the elegant solution is here :) thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> I''m working on a Rails 2.0 app... we''re getting read to use AdWords to > drive some traffic... we plan to use a custom URL per ad (to allow us > to track conversions on Google Analytics). The site is an ecommerce > site. The plan is to route the adds to the same today page (and then > track through to conversion or not). > > So I''d like ad-1 to use the URL www.foobar.com/ad1, ad-2 to use > www.foobar.com/ad2, and so on. Where all the /adX url''s point to > www.foobar.com which is the welcome page. > > I know that routes.rb is the way to go but wondering what the elegant > solution is here :)map.ad /:ad/, :requirements => {:ad => /ad\d+/} Put that just above the default route. If it were me, I''d do it this way just to isolate everything under ''ad'': /ad/1 /ad/2 /ad/3 with a route of: map.ad /ad/:id, :controller => ''home'', :action => ''index'' (assuming home and index are correct for your home page) -philip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Philip, I think the line above has a slight typo in it... the following worked for... map.ad ''/ad/:id'', :controller => ''home'', :action => ''index'' On Jul 28, 9:45 am, Philip Hallstrom <phi...-LSG90OXdqQE@public.gmane.org> wrote:> > I''m working on a Rails 2.0 app... we''re getting read to use AdWords to > > drive some traffic... we plan to use a custom URL per ad (to allow us > > to track conversions on Google Analytics). The site is an ecommerce > > site. The plan is to route the adds to the same today page (and then > > track through to conversion or not). > > > So I''d like ad-1 to use the URLwww.foobar.com/ad1, ad-2 to use > >www.foobar.com/ad2, and so on. Where all the /adX url''s point to > >www.foobar.comwhich is the welcome page. > > > I know that routes.rb is the way to go but wondering what the elegant > > solution is here :) > > map.ad /:ad/, :requirements => {:ad => /ad\d+/} > > Put that just above the default route. > > If it were me, I''d do it this way just to isolate everything under ''ad'': > > /ad/1 > /ad/2 > /ad/3 > > with a route of: > > map.ad /ad/:id, :controller => ''home'', :action => ''index'' > > (assuming home and index are correct for your home page) > > -philip--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---