google analytics for rails production environment

# assuming a partial located in views/shared
# that contains the google analytics script body
def render_google_analytics_script
  render :partial => "/shared/google_analytics" if Rails.env == "production"
end

# render from layouts
<%= render_google_analytics_script %>


Leave a Reply

Formatting: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>