Class: GoogleAnalytics::Event

Inherits:
Struct
  • Object
show all
Defined in:
lib/tracking/event.rb

Overview

A Struct that mirrors the structure of a custom var defined in Google Analytics see developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



8
9
10
# File 'lib/tracking/event.rb', line 8

def action
  @action
end

#categoryObject

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



8
9
10
# File 'lib/tracking/event.rb', line 8

def category
  @category
end

#labelObject

Returns the value of attribute label

Returns:

  • (Object)

    the current value of label



8
9
10
# File 'lib/tracking/event.rb', line 8

def label
  @label
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



8
9
10
# File 'lib/tracking/event.rb', line 8

def value
  @value
end

Instance Method Details

#writeObject



10
11
12
# File 'lib/tracking/event.rb', line 10

def write
  { hitType: 'event', eventCategory: self.category, eventAction: self.action, eventLabel: self.label, eventValue: self.value }.select{|k,v| v }.to_json
end