diff --git a/app/views/common/_discourse_javascript.html.erb b/app/views/common/_discourse_javascript.html.erb
new file mode 100644
index 00000000000..8c54a574241
--- /dev/null
+++ b/app/views/common/_discourse_javascript.html.erb
@@ -0,0 +1,25 @@
+ <%- if mini_profiler_enabled? %>
+ <%- Rack::MiniProfiler.step "application" do %>
+ <%= javascript_include_tag "application" %>
+ <%-end%>
+
+ <%- Rack::MiniProfiler.step "admin" do %>
+ <%= javascript_include_tag "admin"%>
+ <%-end%>
+ <%- else %>
+ <%= javascript_include_tag "application" %>
+ <%- if admin? %>
+ <%= javascript_include_tag "admin"%>
+ <%- end %>
+ <%- end%>
+
+
\ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 68e1351080c..52ccbb50b8f 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -97,33 +97,8 @@
<%= yield :data %>
-
- <%- if mini_profiler_enabled? %>
- <%- Rack::MiniProfiler.step "application" do %>
- <%= javascript_include_tag "application" %>
- <%-end%>
- <%- Rack::MiniProfiler.step "admin" do %>
- <%= javascript_include_tag "admin"%>
- <%-end%>
- <%- else %>
- <%= javascript_include_tag "application" %>
- <%- if admin? %>
- <%= javascript_include_tag "admin"%>
- <%- end %>
- <%- end%>
-
-
-
+ <%= render :partial => "common/discourse_javascript" %>
<%= render_google_analytics_code %>