Module: SimpleAnalyticsRails

Defined in:
lib/simple_analytics_rails.rb,
lib/simple_analytics_rails/version.rb,
lib/simple_analytics_rails/configuration.rb,
lib/simple_analytics_rails/javascript_script.rb

Overview

This will automatically inject the ‘SimpleAnalyticsRails::Middleware::JavascriptInjection` middleware if you’re using Ruby on Rails.

Sample Usage for configuration:

# config/initializers/simple_analytics.rb
SimpleAnalyticsRails.configure do |configuration|
  configuration.hostname = "example.com"
  configuration.mode = "hash"
  configuration.collect_dnt = false
  configuration.ignore_pages = "/search/*,/account/*,/vouchers"
  configuration.sa_global = "sa_event"
  configuration.auto_collect = true
  configuration.onload_callback = "onloadCallback()"
  configuration.custom_domain = "custom.domain.com"
  configuration.enabled = Rails.env.production?
end

Defined Under Namespace

Modules: Middleware Classes: Configuration, JavascriptScript, Railtie

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.configurationObject



30
31
32
# File 'lib/simple_analytics_rails.rb', line 30

def configuration
  @configuration ||= SimpleAnalyticsRails::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



26
27
28
# File 'lib/simple_analytics_rails.rb', line 26

def configure
  yield(configuration)
end

.reset_configuration!Object



34
35
36
# File 'lib/simple_analytics_rails.rb', line 34

def reset_configuration!
  @configuration = nil
end