Skip to content

Commit

Permalink
fix(demo): move step_1 success tracking after the frontend auth (Nang…
Browse files Browse the repository at this point in the history
…oHQ#1961)

## Describe your changes

Fixes NAN-700

We realised the tracking of Step1 in the backend was suboptimal. At this
step we deploy and immediatly trigger a GitHub oauth. In the frontend
the event is correctly reported because it encapsulates both sub-steps
but in the backend the success was reported too early

- Track step1_success only when we actually oauthed to GitHub
  • Loading branch information
bodinsamuel authored Apr 6, 2024
1 parent 98b4010 commit e67494c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/server/lib/controllers/onboarding.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class OnboardingController {
await createOnboardingProvider({ envId: environment.id });
}

void analytics.track(AnalyticsTypes.DEMO_1_SUCCESS, account.id, { user_id: user.id });
res.status(201).json({
id: onboardingId
});
Expand Down Expand Up @@ -345,6 +344,11 @@ class OnboardingController {
if (progress === 3 || progress === 6) {
void analytics.track(AnalyticsTypes[`DEMO_${progress}`], account.id, { user_id: user.id });
}
if (progress === 1) {
// Step 1 is actually deploy+frontend auth
// Frontend is in a different API so we can't instrument it on the backend so we assume if we progress then step 1 was a success
void analytics.track(AnalyticsTypes.DEMO_1_SUCCESS, account.id, { user_id: user.id });
}

res.status(200).json({
success: true
Expand Down

0 comments on commit e67494c

Please sign in to comment.