diff --git a/Gemfile b/Gemfile index 242684c..08126e1 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,9 @@ gem 'spring', group: :development # Sends a email whenever there is a unexpected exception gem 'exception_notification', '~> 4.0.1' +# Google Analytics +gem 'google-analytics-rails', '~> 0.0.6' + group :test do # Easier test writing gem "shoulda-matchers", '~> 2.6.1' diff --git a/Gemfile.lock b/Gemfile.lock index c49e274..c8c576c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,6 +124,7 @@ GEM faraday (>= 0.7.4, < 0.10) gherkin (2.12.2) multi_json (~> 1.3) + google-analytics-rails (0.0.6) hike (1.2.3) i18n (0.6.11) jbuilder (2.1.3) @@ -288,6 +289,7 @@ DEPENDENCIES devise (~> 3.3.0) exception_notification (~> 4.0.1) factory_girl_rails (~> 4.4.1) + google-analytics-rails (~> 0.0.6) jbuilder (~> 2.1.2) jquery-rails jquery-ui-rails (~> 5.0.0) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 722d2bc..a53db2f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -38,6 +38,9 @@ <%= javascript_include_tag "application" %> + + <%= analytics_init if Rails.env.production? %> + <%= csrf_meta_tags %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 78588f3..3d4294b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -105,4 +105,8 @@ Rails.application.configure do :sender_address => %{"mezurometrics" }, :exception_recipients => %w{mezuro-core@lists.ime.usp.br} } + + # Google Analytics + GA.tracker = "<%= ENV['GA_TRACKER'] %>" #"UA-54363591-1" + GA.script_source = :doubleclick end -- libgit2 0.21.2