class GAEvents::Event

Class to define analytical events expected attributes: tid, cid and t

Attributes

params[RW]

Public Class Methods

new(hash = {}) click to toggle source

As per Measurement Protocol, parameters: v, tid, cid and t should always be present. This gem automatically injects v. Ensure you always pass tid, cid and t while initializing events.

# File lib/gaevents/event.rb, line 17
 def initialize(hash = {})
         @params = hash.select { |_k, v| v }
         @params['v'] = 1
end

Public Instance Methods

payload() click to toggle source
# File lib/gaevents/event.rb, line 22
 def payload
         URI.encode_www_form(@params)
end