Commit 5b6628a5bccefbf0a356c313d7bad6f6953b207c

Authored by Renan Fichberg
Committed by Diego Camarinha
1 parent 19f3580e

Google Analytics

signed off by: Rafael Reggiani Manzo <rr.manzo@gmail.com>
Gemfile
... ... @@ -60,6 +60,9 @@ gem &#39;spring&#39;, group: :development
60 60 # Sends a email whenever there is a unexpected exception
61 61 gem 'exception_notification', '~> 4.0.1'
62 62  
  63 +# Google Analytics
  64 +gem 'google-analytics-rails', '~> 0.0.6'
  65 +
63 66 group :test do
64 67 # Easier test writing
65 68 gem "shoulda-matchers", '~> 2.6.1'
... ...
Gemfile.lock
... ... @@ -124,6 +124,7 @@ GEM
124 124 faraday (>= 0.7.4, < 0.10)
125 125 gherkin (2.12.2)
126 126 multi_json (~> 1.3)
  127 + google-analytics-rails (0.0.6)
127 128 hike (1.2.3)
128 129 i18n (0.6.11)
129 130 jbuilder (2.1.3)
... ... @@ -288,6 +289,7 @@ DEPENDENCIES
288 289 devise (~> 3.3.0)
289 290 exception_notification (~> 4.0.1)
290 291 factory_girl_rails (~> 4.4.1)
  292 + google-analytics-rails (~> 0.0.6)
291 293 jbuilder (~> 2.1.2)
292 294 jquery-rails
293 295 jquery-ui-rails (~> 5.0.0)
... ...
app/views/layouts/application.html.erb
... ... @@ -38,6 +38,9 @@
38 38  
39 39 <%= javascript_include_tag "application" %>
40 40  
  41 + <!-- Google Analytics -->
  42 + <%= analytics_init if Rails.env.production? %>
  43 +
41 44 <%= csrf_meta_tags %>
42 45 </head>
43 46 <body>
... ...
config/environments/production.rb
... ... @@ -105,4 +105,8 @@ Rails.application.configure do
105 105 :sender_address => %{"mezurometrics" <mezurometrics@gmail.com>},
106 106 :exception_recipients => %w{mezuro-core@lists.ime.usp.br}
107 107 }
  108 +
  109 + # Google Analytics
  110 + GA.tracker = "<%= ENV['GA_TRACKER'] %>" #"UA-54363591-1"
  111 + GA.script_source = :doubleclick
108 112 end
... ...