code-corps / code-corps-api

Elixir/Phoenix API for Code Corps.
https://www.codecorps.org
MIT License
235 stars 86 forks source link

Track anon Users that register #1383

Open zacck-zz opened 6 years ago

zacck-zz commented 6 years ago

Track anon Users that register

The work on #1105 and #1038 gets us to track core actions, among the actions, we track when an installation is created from GitHub, However, these installations can sometimes lack a current_user as in some cases the user hasn't been to the website or some such case. In that case, we track an anonymous project using the sender id in the payload. This sender id belongs to a user who could potentially discover the website and join.

I am proposing that we track the conversion above that occurs when a user that was previously just tracked from an installation joins the system.

Subtasks

References

Progress on: #1038

begedin commented 6 years ago

@zacck

This makes perfect sense.

However, the thing about analytics tracking is that we would be able to do the same by, for example, defining a funnel in our mixpanel dashboard.

What we need to make sure is that we have enough information to link a github user we got from an installation event, with a codecorps user who just connected to github.

That would mean we need to make sure we perform an alias of a code corps user.id with a code corps user.github_id when a user connects to github.

Look into segment docs, as well as the docs for the segment library we use to see how aliasing works.

Basically, you call alias(id_1, id_2) to tell segment the two users are actually the same user.

Presumably, an installation event would be tracked with the github_id of the sender being the id used to track the user.

On the other hand, user registration would be tracked with the actual user.id stored in the database. Once that user also gets a github_id assigned to them, we call alias(user.id, user.github_id), et voila, our analytics dashboard shows the two users as one and the same.

zacck-zz commented 6 years ago

Definitely some reading to do up but I am going to try this one out