Module: Analytical

Defined in:
lib/analytical.rb,
lib/analytical/api.rb,
lib/analytical/bot_detector.rb,
lib/analytical/modules/base.rb,
lib/analytical/command_store.rb,
lib/analytical/modules/adroll.rb,
lib/analytical/modules/clicky.rb,
lib/analytical/modules/google.rb,
lib/analytical/modules/adwords.rb,
lib/analytical/modules/console.rb,
lib/analytical/modules/hubspot.rb,
lib/analytical/modules/totango.rb,
lib/analytical/modules/comscore.rb,
lib/analytical/modules/loopfuse.rb,
lib/analytical/modules/mixpanel.rb,
lib/analytical/modules/chartbeat.rb,
lib/analytical/modules/crazy_egg.rb,
lib/analytical/modules/quantcast.rb,
lib/analytical/modules/click_tale.rb,
lib/analytical/modules/optimizely.rb,
lib/analytical/modules/kiss_metrics.rb,
lib/analytical/modules/reinvigorate.rb,
lib/analytical/modules/microsoft_ads.rb,
lib/analytical/modules/performancing.rb,
lib/analytical/session_command_store.rb,
lib/analytical/modules/google_optimizer.rb

Defined Under Namespace

Modules: BotDetector, InstanceMethods, Modules Classes: Api, CommandStore, SessionCommandStore

Instance Method Summary collapse

Instance Method Details

#analytical(options = {}) ⇒ Object

any method placed here will apply to ActionController::Base



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/analytical.rb', line 9

def analytical(options={})
  send :include, InstanceMethods
  send :include, Analytical::BotDetector
  helper_method :analytical
  class_inheritable_accessor :analytical_options

  self.analytical_options = options.reverse_merge({
    :modules=>[],
    :development_modules=>[:console],
    :disable_if=>Proc.new { !Rails.env.production? },
  })

  config_options = {}
  File.open("#{Rails.root}/config/analytical.yml") do |f|
    config_options = YAML::load(ERB.new(f.read).result).symbolize_keys
    config_options.each do |k,v|
      config_options[k] = v.symbolize_keys
    end
  end if File.exists?("#{Rails.root}/config/analytical.yml")

  self.analytical_options = self.analytical_options.reverse_merge config_options
end