Repository navigation
Send exercise_completed to PostHog - #13173
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exercise slug already shows whether it was hello-world. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR sends an
exercise_completedevent to PostHog when a user completes a solution. PostHog currently only learns that someone has activated (completed an exercise other than Hello World) whensite_visitedrefreshes theircompleted_non_hello_worldperson property on their next daily visit. With this event, PostHog will see the moment someone activates, so the retention chart can group people by the week they activated.The event
exercise_completedIt carries:
trackandexercise(slugs).checkout_succeeded:exercises_completed(which includes this exercise),completed_hello_world,completed_non_hello_world,mentoring_sessionsanddays_since_signup.membership_type,locale, IP and user agent.It also refreshes the user's person properties in
$set, assite_visiteddoes, socompleted_non_hello_worldbecomes true as soon as someone activates.How it works
Solution::Completesends the event throughAnalytics::TrackEvent.defer, withset_person_propertiesandsnapshot_activity. The job works out the activity withAnalytics::DetermineActivityPropertieson theanalyticsqueue, so the event adds no queries to the request.Solution::Completereturns early when the solution is already completed, so the event is only sent once per solution. Publishing an already completed solution or submitting a new iteration doesn't send it again.Solution::Uncompleteclears its completion. If they then complete it again, the event will be sent a second time.🤖 Generated with Claude Code