Skip to content

Commit

Permalink
give Mixpanel more info about users to help build profiles more accur…
Browse files Browse the repository at this point in the history
…ately
  • Loading branch information
millerti committed Feb 14, 2025
1 parent 20b6545 commit 46032bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/lib/mixpanel_event_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ def track(event_type, request, attributes = {})

# This creates a profile for a distinct user
flow_id = attributes.fetch(:cbv_flow_id, "")
@tracker.people.set(distinct_id, { cbv_flow_id: flow_id })

tracker_attrs = { cbv_flow_id: flow_id }
if request.present?
tracker_attrs.merge!({ ip: request.ip })
end

@tracker.people.set(distinct_id, tracker_attrs)
end

# MaybeLater tries to run this code after the request has finished
Expand Down

0 comments on commit 46032bf

Please sign in to comment.