mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add onboarding info fields to first user setup (#23989)
Add optional demographic and newsletter preference fields to the setup page: business use (yes/no), industry type, organization size, and two newsletter toggles (marketing, release/security updates). The new data flows through telemetry via a FirstUserOnboarding struct in the snapshot payload, sent once when the first user is created. The telemetry-server and BigQuery schema changes are required separately to persist this data. --------- Co-authored-by: default <davidiii@fraley.us> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
default
Claude Sonnet 4.6
parent
53482adc2d
commit
da3c46b557
+19
-1
@@ -281,8 +281,26 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
|
||||
telemetryUser := telemetry.ConvertUser(user)
|
||||
// Send the initial users email address!
|
||||
telemetryUser.Email = &user.Email
|
||||
// Only populate onboarding data when the client actually sent it. A nil
|
||||
// OnboardingInfo means the request came from an older client, the CLI, or
|
||||
// the OIDC flow — not from a user who answered "no" to every question.
|
||||
//
|
||||
// Note: newsletter consent (NewsletterMarketing) is bundled here alongside
|
||||
// product-analytics fields. These may have different legal bases under GDPR
|
||||
// and should be separated in a follow-up once the legal posture is clarified.
|
||||
var onboarding *telemetry.FirstUserOnboarding
|
||||
if createUser.OnboardingInfo != nil {
|
||||
onboarding = &telemetry.FirstUserOnboarding{
|
||||
IsBusiness: createUser.OnboardingInfo.IsBusiness,
|
||||
IndustryType: string(createUser.OnboardingInfo.IndustryType),
|
||||
OrgSize: string(createUser.OnboardingInfo.OrgSize),
|
||||
NewsletterMarketing: createUser.OnboardingInfo.NewsletterMarketing,
|
||||
NewsletterReleases: createUser.OnboardingInfo.NewsletterReleases,
|
||||
}
|
||||
}
|
||||
api.Telemetry.Report(&telemetry.Snapshot{
|
||||
Users: []telemetry.User{telemetryUser},
|
||||
Users: []telemetry.User{telemetryUser},
|
||||
FirstUserOnboarding: onboarding,
|
||||
})
|
||||
|
||||
httpapi.Write(ctx, rw, http.StatusCreated, codersdk.CreateFirstUserResponse{
|
||||
|
||||
Reference in New Issue
Block a user