Class: AbPanel::Mixpanel::Tracker

Inherits:
Mixpanel::Tracker
  • Object
show all
Defined in:
lib/ab_panel/mixpanel.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Tracker

Returns a new instance of Tracker.



6
7
8
9
10
# File 'lib/ab_panel/mixpanel.rb', line 6

def initialize(options = {})
  return if !should_track?

  @tracker = ::Mixpanel::Tracker.new Config.token, ab_panel_options.merge(options)
end

Instance Method Details

#ab_panel_optionsObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ab_panel/mixpanel.rb', line 12

def ab_panel_options
  opts = {
    env:     AbPanel.env,
    persist: true
  }

  AbPanel.funnels.each do |funnel|
    opts["funnel_#{funnel}"] = true
  end

  opts
end

#identify(distinct_id) ⇒ Object



31
32
33
34
35
# File 'lib/ab_panel/mixpanel.rb', line 31

def identify(distinct_id)
  return if !should_track?

  @tracker.append_identify distinct_id
end

#track(event_name, properties) ⇒ Object



25
26
27
28
29
# File 'lib/ab_panel/mixpanel.rb', line 25

def track(event_name, properties)
  return if !should_track?

  @tracker.append_track event_name, properties
end