Skip to content

Commit 02cebeb

Browse files
authored
ab test signup flow (#1030)
* ab test for new signup ux * cleanup p1 * base ab test on variance of machineId instead of random coin flip
1 parent 098b420 commit 02cebeb

1 file changed

Lines changed: 61 additions & 26 deletions

File tree

shared/ui/Authentication/Signup.tsx

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export const Signup = (props: Props) => {
128128
isInVSCode: state.ide.name === "VSC",
129129
supportsVSCodeGithubSignin: state.capabilities.vsCodeGithubSignin,
130130
acceptedTOS: state.session.acceptedTOS,
131+
machineId: state.session.machineId || "0",
131132
webviewFocused: state.context.hasFocus,
132133
pendingProtocolHandlerQuerySource: state.context.pendingProtocolHandlerQuery?.src,
133134
environmentHosts,
@@ -154,6 +155,11 @@ export const Signup = (props: Props) => {
154155
const [authenticationProviders, setAuthenticationProviders] = useState({});
155156
const [checkForWebmail, setCheckForWebmail] = useState(true);
156157

158+
// @TODO: Delete when done with A/B test
159+
// Purpose of this value is to direct ~50% of users to a new UX, and ~50% to
160+
// the old, and compare which one is a more effective signup flow and funnel
161+
const [abTestValue, setAbTestValue] = useState<number | undefined>();
162+
157163
const wasInvited = props.inviteCode !== undefined;
158164

159165
const { environmentHosts, selectedRegion, forceRegion, supportsMultiRegion } = derivedState;
@@ -213,8 +219,24 @@ export const Signup = (props: Props) => {
213219

214220
useDidMount(() => {
215221
getUserInfo();
216-
if (derivedState.webviewFocused)
217-
HostApi.instance.track("Page Viewed", { "Page Name": "Create Account" });
222+
// @TODO: Temp code, delete when which UX is determined to be best
223+
// 0 = old version (Signup for a codestream account, for free)
224+
// 1 = connect version
225+
//
226+
// machineId is alphanumeric, so we parse it to contain only numeric values.
227+
// Then we need to trim down the value to a length of 10 digits max because
228+
// remainder calculations have rounding errors on numbers that are too large.
229+
const machineIdNumeric = derivedState.machineId.replace(/\D/g, "").substring(0, 10);
230+
const _abTestValue = Number(machineIdNumeric) % 2;
231+
setAbTestValue(_abTestValue);
232+
if (derivedState.webviewFocused) {
233+
if (_abTestValue === 0) {
234+
HostApi.instance.track("Page Viewed", { "Page Name": "Create Account" });
235+
}
236+
if (_abTestValue === 1) {
237+
HostApi.instance.track("Page Viewed", { "Page Name": "Create Account (Connect Version)" });
238+
}
239+
}
218240
if (props.teamId) getTeamAuthInfo(props.teamId);
219241
});
220242

@@ -478,7 +500,8 @@ export const Signup = (props: Props) => {
478500
<fieldset className="form-body" style={{ paddingTop: 0, paddingBottom: 0 }}>
479501
<div id="controls">
480502
<div className="border-bottom-box">
481-
<h3>Create a CodeStream account, for free</h3>
503+
{abTestValue === 0 && <h3>Create a CodeStream account, for free</h3>}
504+
{abTestValue === 1 && <h3>Connect to get started</h3>}
482505
<br />
483506
{regionItems && !forceRegionName && (
484507
<>
@@ -545,30 +568,42 @@ export const Signup = (props: Props) => {
545568
</Button>
546569
</SignupButtonContainer>
547570
)}
548-
{(!limitAuthentication || authenticationProviders["email"]) && !showEmailForm && (
549-
<SignupButtonContainer>
550-
<Button className="row-button no-top-margin" onClick={onClickEmailSignup}>
551-
<Icon name="codestream" />
552-
<div className="copy">Email</div>
553-
<Icon name="chevron-right" />
554-
</Button>
555-
</SignupButtonContainer>
556-
)}
571+
{(!limitAuthentication || authenticationProviders["email"]) &&
572+
!showEmailForm &&
573+
abTestValue === 0 && (
574+
<SignupButtonContainer>
575+
<Button className="row-button no-top-margin" onClick={onClickEmailSignup}>
576+
<Icon name="codestream" />
577+
<div className="copy">Email</div>
578+
<Icon name="chevron-right" />
579+
</Button>
580+
</SignupButtonContainer>
581+
)}
557582
</SignupButtonsContainer>
558-
<OnPremWrapper id={`on-prem-wrapper`}>
559-
Codestream supports on-prem code hosts as well. {` `}
560-
<Tooltip
561-
key="on-prem"
562-
title={`CodeStream supports both cloud and on-prem versions of GitHub,
563-
GitLab and Bitbucket. However, only the cloud versions are available
564-
to use for CodeStream authentication. If you use an on-prem version of
565-
these services, sign up for CodeStream using a different method and then
566-
connect to your code host from the Integrations page in CodeStream.`}
567-
placement="bottom"
568-
>
569-
<OnPremTooltipCopy>Learn More</OnPremTooltipCopy>
570-
</Tooltip>
571-
</OnPremWrapper>
583+
{abTestValue === 0 && (
584+
<OnPremWrapper id={`on-prem-wrapper`}>
585+
Codestream supports on-prem code hosts as well. {` `}
586+
<Tooltip
587+
key="on-prem"
588+
title={`CodeStream supports both cloud and on-prem versions of GitHub,
589+
GitLab and Bitbucket. However, only the cloud versions are available
590+
to use for CodeStream authentication. If you use an on-prem version of
591+
these services, sign up for CodeStream using a different method and then
592+
connect to your code host from the Integrations page in CodeStream.`}
593+
placement="bottom"
594+
>
595+
<OnPremTooltipCopy>Learn More</OnPremTooltipCopy>
596+
</Tooltip>
597+
</OnPremWrapper>
598+
)}
599+
600+
{(!limitAuthentication || authenticationProviders["email"]) &&
601+
!showEmailForm &&
602+
abTestValue === 1 && (
603+
<OnPremWrapper id={`on-prem-wrapper`}>
604+
Your service not listed? <Link onClick={onClickEmailSignup}>Skip This</Link>
605+
</OnPremWrapper>
606+
)}
572607
{showOr && showEmailForm && (
573608
<div className="separator-label">
574609
<span className="or">

0 commit comments

Comments
 (0)