Open joshsmith opened 6 years ago
Re:
- we're sending too many events close to the
alias
, leading to a race condition
We already agreed we should weer of off implicit tracking through Plugs.Segment
and instead track explicitly from the controller action.
We did this in other places, but it looks like here, we still implicitly track user created using the plug. This may cause some parallelism, which may be what's causing race conditions.
If we moved tracking to be explicit, we may eliminate this, but I'm not sure.
We would do this by
def includes?(:create, %CodeCorps.User{}), do: true
from lib/code_corps/analytics/segment_tracking_support.ex
user_id |> SegmentTracker.track("Signed Up", user)
to the create action
I also think we should add a function clause to CodeCorps.Analytics.SegmentTracker
which accepts the user struct as the first argument, instead of just the id, but that's a whole other issue.
What's in this PR?
Allows us to alias the user on creation.
This is a WIP and very much incomplete.
A few of the issues we have with this:
alias
, leading to a race condition