Class: GAEvents::Event
- Inherits:
-
Object
- Object
- GAEvents::Event
- Defined in:
- lib/gaevents/event.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Event
constructor
As per Measurement Protocol, parameters: v, tid, cid and t should always be present.
- #payload ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Event
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.
13 14 15 16 |
# File 'lib/gaevents/event.rb', line 13 def initialize(hash = {}) @params = hash.reject { |k,v| !v } @params["v"] = 1 end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/gaevents/event.rb', line 3 def params @params end |
Instance Method Details
#payload ⇒ Object
18 19 20 |
# File 'lib/gaevents/event.rb', line 18 def payload URI.encode_www_form(@params) end |