DOCS LLMs

Analytics

If you're using an analytics service like Google Analytics, Umami, SimpleAnalytics, etc. you can add its tag to app/views/layouts/html_head/_analytics.html.erb, and this will achieve three things:

  • It will add your analytics tag to all pages
  • Without cluttering the main layout (app/views/layouts/application.html.erb)
  • It's instantly reusable by other layouts in your app (like app/views/layouts/devise.html.erb) maintaining a single source of truth for all your analytics tags