diff --git a/app/helpers/common_helper.rb b/app/helpers/common_helper.rb new file mode 100644 index 00000000000..83ee98efa5b --- /dev/null +++ b/app/helpers/common_helper.rb @@ -0,0 +1,7 @@ +module CommonHelper + def render_google_analytics_code + if Rails.env == "production" && SiteSetting.ga_tracking_code.present? + render :partial => "common/google_analytics" + end + end +end \ No newline at end of file diff --git a/app/views/common/_google_analytics.html.erb b/app/views/common/_google_analytics.html.erb new file mode 100644 index 00000000000..79f2414e848 --- /dev/null +++ b/app/views/common/_google_analytics.html.erb @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 106abd5f98d..68e1351080c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -124,22 +124,7 @@ Discourse.initialize() - <%- if Rails.env == "production" and SiteSetting.ga_tracking_code.present? %> - - <%-end%> + <%= render_google_analytics_code %>