Module: Analytical::InstanceMethods

Defined in:
lib/analytical.rb

Instance Method Summary collapse

Instance Method Details

#analyticalObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/analytical.rb', line 33

def analytical
  @analytical ||= begin
    options = self.class.analytical_options.merge({
      :ssl => request.ssl?,
      :controller => self,
    })
    if options[:disable_if] && options[:disable_if].call(self)
      options[:modules] = []
    end
    options[:session] = session if options[:use_session_store]
    if analytical_is_robot?(request.user_agent)
      options[:modules] = []
    end
    options[:modules] = options[:filter_modules].call(self, options[:modules]) if options[:filter_modules]
    options[:javascript_helpers] ||= true if options[:javascript_helpers].nil?
    Analytical::Api.new options
  end
end