Class: TestTrack::AnalyticsEvent

Inherits:
Object
  • Object
show all
Defined in:
app/models/test_track/analytics_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(visitor_id, assignment) ⇒ AnalyticsEvent

Returns a new instance of AnalyticsEvent.



5
6
7
8
# File 'app/models/test_track/analytics_event.rb', line 5

def initialize(visitor_id, assignment)
  @visitor_id = visitor_id
  @assignment = assignment
end

Instance Attribute Details

#assignmentObject (readonly)

Returns the value of attribute assignment.



3
4
5
# File 'app/models/test_track/analytics_event.rb', line 3

def assignment
  @assignment
end

#visitor_idObject (readonly)

Returns the value of attribute visitor_id.



3
4
5
# File 'app/models/test_track/analytics_event.rb', line 3

def visitor_id
  @visitor_id
end

Instance Method Details

#nameObject



10
11
12
13
14
15
16
# File 'app/models/test_track/analytics_event.rb', line 10

def name
  if assignment.feature_gate?
    'feature_gate_experienced'
  else
    'split_assigned'
  end
end

#propertiesObject



18
19
20
21
22
23
24
25
# File 'app/models/test_track/analytics_event.rb', line 18

def properties
  {
    test_track_visitor_id: visitor_id,
    split_name: assignment.split_name,
    split_variant: assignment.variant,
    split_context: assignment.context
  }
end