Module: Stealth::MixpanelSessionTracking

Included in:
Session
Defined in:
lib/stealth-mixpanel/state_transitions.rb

Instance Method Summary collapse

Instance Method Details

#set(flow:, state:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/stealth-mixpanel/state_transitions.rb', line 3

def set(flow:, state:)
  retval = super

  if ENV['MIXPANEL_PROJECT_TOKEN'].present?
    mixpanel = Stealth::Mixpanel.new
    mixpanel.tracker.track(user_id, 'State Change', {
      'flow' => flow,
      'state' => state
    })
  end

  retval
end