From 96ace3265e2035a9a567cdf1dc00d556ec311c5d Mon Sep 17 00:00:00 2001 From: farhatahmad <35435341+farhatahmad@users.noreply.github.com> Date: Mon, 19 Aug 2019 08:51:57 -0400 Subject: [PATCH] Added Google Analytics (#749) --- app/helpers/application_helper.rb | 4 ++++ app/views/layouts/application.html.erb | 12 ++++++++++++ config/application.rb | 2 ++ sample.env | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 36959085..e1e901c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -135,4 +135,8 @@ module ApplicationHelper Rails.application.routes.recognize_path(request.env['PATH_INFO'])[:action] == "edit_user" && @user.greenlight_account? end + + def google_analytics_url + "https://www.googletagmanager.com/gtag/js?id=#{ENV['GOOGLE_ANALYTICS_TRACKING_ID']}" + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8c730423..f37c4d04 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -16,6 +16,18 @@
+ <% if Rails.configuration.google_analytics %> + + + + <% end %> +