Class: Exvo::Metrics
- Inherits:
-
Object
- Object
- Exvo::Metrics
- Defined in:
- lib/exvo/metrics.rb,
lib/exvo/metrics/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #identify(user) ⇒ Object
-
#initialize(user, request) ⇒ Metrics
constructor
A new instance of Metrics.
- #method_missing(method, *args, &block) ⇒ Object
- #track(event_name, properties = {}) ⇒ Object
-
#track_anonymously(event_name, properties = {}) ⇒ Object
Track things without identifying the user.
Constructor Details
#initialize(user, request) ⇒ Metrics
Returns a new instance of Metrics.
9 10 11 |
# File 'lib/exvo/metrics.rb', line 9 def initialize(user, request) @user, @request = user, request end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
28 29 30 |
# File 'lib/exvo/metrics.rb', line 28 def method_missing(method, *args, &block) metrics_platform.public_send(method, *args, &block) end |
Instance Method Details
#identify(user) ⇒ Object
13 14 15 16 |
# File 'lib/exvo/metrics.rb', line 13 def identify(user) @user = user append_identification end |
#track(event_name, properties = {}) ⇒ Object
18 19 20 21 |
# File 'lib/exvo/metrics.rb', line 18 def track(event_name, properties = {}) append_identification unless identified? metrics_platform.append_track(event_name, properties) end |
#track_anonymously(event_name, properties = {}) ⇒ Object
Track things without identifying the user. Useful for page view/site visit trakcing
24 25 26 |
# File 'lib/exvo/metrics.rb', line 24 def track_anonymously(event_name, properties = {}) metrics_platform.append_track(event_name, properties) end |