Module: GoogleAnalytics

Defined in:
lib/google-analytics-rails.rb,
lib/google-analytics/events.rb,
lib/google-analytics/version.rb,
lib/google-analytics/events/event.rb,
lib/google-analytics/events/events.rb,
lib/google-analytics/async_tracking_queue.rb,
lib/google-analytics/events/event_renderer.rb,
lib/google-analytics/events/event_collection.rb,
lib/google-analytics/events/event_collection_renderer.rb

Defined Under Namespace

Modules: Events, Rails Classes: AsyncTrackingQueue, Event, EventCollection, EventCollectionRenderer, EventRenderer, SingleEvent

Constant Summary collapse

VERSION =

Gem version

"1.1.1"

Class Method Summary collapse

Class Method Details

.max_custom_indicesInteger

Return the maximum number of custom dimension/metric indices for this type of account

Returns:

  • (Integer)


68
69
70
# File 'lib/google-analytics-rails.rb', line 68

def self.max_custom_indices
  premium_account? ? MAX_PREMIUM_INDICES : MAX_REGULAR_INDICES
end

.premium_account=(value) ⇒ Object

Set whether or not the property is held under a premium account

Parameters:

  • (Boolean)


62
63
64
# File 'lib/google-analytics-rails.rb', line 62

def self.premium_account=(value)
  @@premium_account = value
end

.premium_account?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/google-analytics-rails.rb', line 56

def self.premium_account?
  @@premium_account ||= false
end

.script_sourceString

Returns:

  • (String)


41
42
43
# File 'lib/google-analytics-rails.rb', line 41

def self.script_source
  @@src ||= SCRIPT_SOURCES[:default]
end

.script_source=(src) ⇒ String

Set the current ga src.

Returns:

  • (String)


47
48
49
50
51
52
53
# File 'lib/google-analytics-rails.rb', line 47

def self.script_source=(src)
  if SCRIPT_SOURCES.has_key?(src)
    @@src = SCRIPT_SOURCES[src]
  else
    @@src = src
  end
end

.trackerString

Get the current tracker id (UA-xxxxxx-x).

Returns:

  • (String)


25
26
27
# File 'lib/google-analytics-rails.rb', line 25

def self.tracker
  @@tracker ||= PLACEHOLDER_TRACKER
end

.tracker=(tracker) ⇒ Object

Set the current tracker id.

Parameters:

  • tracker (String)

    The tracker id (ie. "UA-xxxxxx-x").



31
32
33
# File 'lib/google-analytics-rails.rb', line 31

def self.tracker=(tracker)
  @@tracker = tracker
end

.valid_tracker?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/google-analytics-rails.rb', line 36

def self.valid_tracker?
  tracker.nil? || tracker == "" || tracker == PLACEHOLDER_TRACKER ? false : true
end