Skip to content

Track project events #1364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 14, 2018
Merged

Conversation

iref
Copy link
Contributor

@iref iref commented Jan 8, 2018

What's in this PR?

Segment plug tracker now also tracks events for project ids if id is extractable from request resource.
There is more work to be done. Mostly to add acceptor property in Approved Project Membership event. This change might require passing of optional current user to SegmentTraitBuilder.build

References

Closes #1285
Progress on: #927

@iref iref requested a review from joshsmith January 8, 2018 15:59
@iref
Copy link
Contributor Author

iref commented Jan 8, 2018

@joshsmith please let me know if these changes match what we discussed in #1307 .

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally moving in the right direction, though refer back to this comment I had about the event names needing to change to be explicit about the directionality:

This means we'd actually rewrite the events as Membership Requested (Project) and Approved Membership (Project) from the perspective of the project. But we would also track a Requested Membership (User) and Membership Approved (User) from the perspective of the user.

"""
@spec get_project_id(CodeCorps.ProjectUser.t) :: String.t | nil
def get_project_id(%CodeCorps.ProjectUser{project_id: id}), do: "project_#{id}"
def get_project_id(_), do: nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this up above get_resource just to keep things alpha-ordered. We try to generally alpha-order things for quick scannability.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved, but github did not mark it outdated.

iref added 6 commits January 11, 2018 12:23
Tracking of project user events was moved to project_user controller.
This change allows us to use existing tracking api without need of
passing additional arguments like current user or action to
SegmentTraitsBuilder.build/2 that arent needed in other explicitly
tracked events.
@iref
Copy link
Contributor Author

iref commented Jan 12, 2018

I added direction to tracked events. I moved project user tracking to controller. It allows us to create events name and payloads without changes to analytics api, which wouldn't be possible if we kept tracking in plug
(SegmentTraitsBuilder.build function would need action and current user as additional parameters passed from plug) these changes aren't required by other implicitly tracked events and would complicate api. It also helps with #927.

@iref iref changed the title [WIP] Track project events Track project events Jan 12, 2018
@begedin
Copy link
Contributor

begedin commented Jan 12, 2018

@iref That was a good call. We're actually gradually shifting away from the plug and and adding explicit tracking in controllers in other places as well.

Copy link
Contributor

@begedin begedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this further, I'm not so sure we should be tracking an event identifying as a project.

The way I see it, from the project's POV, we should still track which user (project admin or owner), approved the membership, or invited a user.

We know which project it happened on from the traits themselves. If we suddenly start recording events triggered by users which are actually project records, our segment dashboard will become confusing.

@joshsmith What do you think?

@joshsmith
Copy link
Contributor

@begedin you're misunderstanding the problem that led to this. Please read #1307 (comment)

@begedin
Copy link
Contributor

begedin commented Jan 22, 2018

@joshsmith I assumed, incorrectly, that it would be possible to define a funnel which does not revolve around the user_id, using custom events, so that's where my confusion comes from.

From what I can tell after looking into it more deeply, that isn't possible, so I guess this is our only option.

Since, with #1351 we also have membership invites to projects, I guess we'll have to do something similar there. I'll add a comment to that PR about how I think we should do it.

@begedin begedin mentioned this pull request Jan 22, 2018
3 tasks
@begedin begedin force-pushed the develop branch 10 times, most recently from 488d755 to 46dfe17 Compare February 12, 2018 15:14
@begedin begedin force-pushed the develop branch 8 times, most recently from e075407 to 6d6cc63 Compare February 12, 2018 16:17
@iref
Copy link
Contributor Author

iref commented Feb 14, 2018

Did you get a change to review changes? Is there anything else I should improve before merge?

@begedin
Copy link
Contributor

begedin commented Feb 14, 2018

@iref sorry for the delay on this. We had some things to tace care of before merging this one. It looks good to go to me 👍

@begedin begedin merged commit 17ff2bc into code-corps:develop Feb 14, 2018
@iref
Copy link
Contributor Author

iref commented Feb 14, 2018

No problem. I just wanted update to make sure that I didn't forget anything. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track whether a user's membership was approved
3 participants