Class: Ahoy::Stores::LogStore
- Defined in:
- lib/ahoy/stores/log_store.rb
Direct Known Subclasses
BunnyStore, FluentdStore, KafkaStore, KinesisFirehoseStore, NatsStore, NsqStore
Instance Method Summary collapse
- #track_event(name, properties, options) {|data| ... } ⇒ Object
- #track_visit(options) {|data| ... } ⇒ Object
Methods inherited from BaseStore
#authenticate, #exclude?, #generate_id, #initialize, #report_exception, #user, #visit
Constructor Details
This class inherits a constructor from Ahoy::Stores::BaseStore
Instance Method Details
#track_event(name, properties, options) {|data| ... } ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ahoy/stores/log_store.rb', line 17 def track_event(name, properties, , &block) data = { id: [:id], name: name, properties: properties, visit_id: ahoy.visit_id, visitor_id: ahoy.visitor_id } data[:user_id] = user.id if user data[:time] = [:time] yield(data) if block_given? log_event(data) end |
#track_visit(options) {|data| ... } ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ahoy/stores/log_store.rb', line 4 def track_visit(, &block) data = { id: ahoy.visit_id, visitor_id: ahoy.visitor_id }.merge(visit_properties.to_hash) data[:user_id] = user.id if user data[:started_at] = [:started_at] yield(data) if block_given? log_visit(data) end |