If you don't need them in your development and test environment, then include them just in the production environment.
# app/views/layouts/application.html.erb ... <% if Rails.env.production? %> <script src="http://some-external-script.com/script.sj"></script> <script> // google analytics code </script> <% end %> </body> </html>
There is issue mainly with the scripts which are connecting to some external services. Like Google Analytics and so...
If you need to connect to some external services, than it is much more complicated. However check this article for possible solution.