Skip to content

Onboarding: Add a team setup step - #6822

Merged
RobertJoonas merged 14 commits into
masterfrom
setup-team-onboarding
Oct 29, 2026
Merged

RobertJoonas merged 14 commits into
masterfrom
setup-team-onboarding

Conversation

@RobertJoonas

@RobertJoonas RobertJoonas commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes

After adding a site (or skipping it), the onboarding flow now includes another optional step to create a team. If a site was added, it suggests a team name based on the site domain, using the label right before the public suffix and "humanizing" it.

Since adding a site can be skipped, we now need a new way to create a team from scratch. A Teams.create function was added for that. The TeamSetup LiveView now handles both cases:

  1. when a site is added during onboarding, it goes under my personal sites under the hood at first, which the team setup then converts into a real team (the existing path).
  2. when adding a site is skipped, the new Teams.create ends up being called

As for the UI, it makes the team setup page follow the style of "Add new site" -- no footer, no global notices, no focus box. The differences between the existing "create a team" page and the onboarding one:

  • The flow progress rendered at the bottom of the page (onboarding only)
  • Secondary action
    • Onboarding: "Skip" -- a link to either the installation step or /sites, depending on whether a site was added
    • Regular "create team" page: "Cancel" -- a link to "/sites" (added in this PR)
  • Page header: onboarding has no trial badge and no team switcher in the account dropdown menu

Tests

  • Automated tests have been added

Changelog

  • An entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • The UI has been tested both in dark and light mode

Makes the current TeamSetup LiveView handle both:

1. team setup from "My personal sites"
2. a new team creation from scratch

Also fixes the E2E test login utility which wasn't used before (getByLabel('Password') also matched with the login page's "Toggle password visibility").
When a user whose email has been invited to a team, or as a guest, signs
up via the standard register form (not the email link), we redirect them
to /sites instead of sending them through onboarding. On the /sites page,
they see the invitation banner.

This already works for team invitations, but only if the team has at
least one site. This commit makes sure that even an invitation to
a team *without sites* ends up triggering the redirect.
@github-actions

Copy link
Copy Markdown
Preview environment👷🏼‍♀️🏗️
PR-6822

@RobertJoonas
RobertJoonas requested a review from a team October 28, 2026 17:10

@aerosol aerosol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Played with it on QA, looks nice. I also checked SSO account locally and it seems to behave well.

I'm not sure about the default flow now and trusting the domain parameter - see comments inline.

Comment thread lib/plausible/teams/team.ex Outdated
label or is invalid according to the rules of `valid_suggestion?/1`.
"""
def suggested_name_from_domain(domain, user_name) when is_binary(domain) do
with [host | _] <- String.split(domain, ["/", ":"], parts: 2),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why :? it's disallowed via domain validation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread lib/plausible_web/live/team_setup.ex Outdated
def mount(params, _session, socket) do
team = socket.assigns.current_team
onboarding? = params["flow"] == Flows.register()
domain = params["domain"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should verify if this is a site accessible to current user at this stage, so we never redirect to /arbitrary-input/installation etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

)

def new(conn, params) do
flow = params["flow"] || PlausibleWeb.Flows.register()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that since we default to /register it means visiting /sites/new (without any extra flow param) will always prompt for team creation, even if we're past that step?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you're right. While all the in-app "add site" links contain ?flow=provisioning, the user can still go to /sites/new by typing it in the URL manually. It should default to provisioning.

Defaulting to flow=register already affects master too (onboarding style UI with flow progress, a "Skip" button instead of "Back to sites"). But indeed, this PR makes it worse. A user on "My personal sites" would be prompted to create a team again.

The create_site_email (a reminder to people who've signed up but haven't added a site or created a team yet) currently links to a bare /sites/new. So changing the default now would lead all those email link clicks to the provisioning flow instead. I've now updated the link in the email with ?flow=register (and the redirect after register form login), but I'd give it a week or so before changing the default to make sure all sent out emails still lead to onboarding. 53c49d8

@RobertJoonas
RobertJoonas added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit 61a4311 Oct 29, 2026
21 checks passed
@RobertJoonas
RobertJoonas deleted the setup-team-onboarding branch October 29, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants