Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
55b52046
Commit
55b52046
authored
Dec 01, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove known fields from trial sign up form
Growth experiment to improve the conversion rate
parent
f8dcbdd1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
10 deletions
+95
-10
ee/app/controllers/trials_controller.rb
ee/app/controllers/trials_controller.rb
+2
-0
ee/app/views/trials/new.html.haml
ee/app/views/trials/new.html.haml
+18
-9
ee/spec/controllers/trials_controller_spec.rb
ee/spec/controllers/trials_controller_spec.rb
+24
-1
ee/spec/views/trials/new.html.haml_spec.rb
ee/spec/views/trials/new.html.haml_spec.rb
+48
-0
lib/gitlab/experimentation.rb
lib/gitlab/experimentation.rb
+3
-0
No files found.
ee/app/controllers/trials_controller.rb
View file @
55b52046
...
@@ -13,6 +13,7 @@ class TrialsController < ApplicationController
...
@@ -13,6 +13,7 @@ class TrialsController < ApplicationController
feature_category
:purchase
feature_category
:purchase
def
new
def
new
record_experiment_user
(
:remove_known_trial_form_fields
)
end
end
def
select
def
select
...
@@ -34,6 +35,7 @@ class TrialsController < ApplicationController
...
@@ -34,6 +35,7 @@ class TrialsController < ApplicationController
@result
=
GitlabSubscriptions
::
ApplyTrialService
.
new
.
execute
(
apply_trial_params
)
@result
=
GitlabSubscriptions
::
ApplyTrialService
.
new
.
execute
(
apply_trial_params
)
if
@result
&
.
dig
(
:success
)
if
@result
&
.
dig
(
:success
)
record_experiment_conversion_event
(
:remove_known_trial_form_fields
)
redirect_to
group_url
(
@namespace
,
{
trial:
true
})
redirect_to
group_url
(
@namespace
,
{
trial:
true
})
else
else
render
:select
render
:select
...
...
ee/app/views/trials/new.html.haml
View file @
55b52046
...
@@ -10,15 +10,24 @@
...
@@ -10,15 +10,24 @@
=
render
'errors'
=
render
'errors'
=
form_tag
create_lead_trials_path
(
glm_params
),
method: :post
do
|
f
|
=
form_tag
create_lead_trials_path
(
glm_params
),
method: :post
do
|
f
|
-
if
experiment_enabled?
(
:remove_known_trial_form_fields
)
&&
current_user
.
first_name
.
present?
=
hidden_field_tag
:first_name
,
current_user
.
first_name
-
else
.form-group
.form-group
=
label_tag
:first_name
,
_
(
'First name'
),
for: :first_name
,
class:
'col-form-label'
=
label_tag
:first_name
,
_
(
'First name'
),
for: :first_name
,
class:
'col-form-label'
=
text_field_tag
:first_name
,
params
[
:first_name
]
||
current_user
.
first_name
,
class:
'form-control'
,
required:
true
=
text_field_tag
:first_name
,
params
[
:first_name
]
||
current_user
.
first_name
,
class:
'form-control'
,
required:
true
-
if
experiment_enabled?
(
:remove_known_trial_form_fields
)
&&
current_user
.
last_name
.
present?
=
hidden_field_tag
:last_name
,
current_user
.
last_name
-
else
.form-group
.form-group
=
label_tag
:last_name
,
_
(
'Last name'
),
for: :last_name
,
class:
'col-form-label'
=
label_tag
:last_name
,
_
(
'Last name'
),
for: :last_name
,
class:
'col-form-label'
=
text_field_tag
:last_name
,
params
[
:last_name
]
||
current_user
.
last_name
,
class:
'form-control'
,
required:
true
=
text_field_tag
:last_name
,
params
[
:last_name
]
||
current_user
.
last_name
,
class:
'form-control'
,
required:
true
-
if
experiment_enabled?
(
:remove_known_trial_form_fields
)
&&
current_user
.
organization
.
present?
=
hidden_field_tag
:company_name
,
current_user
.
organization
-
else
.form-group
.form-group
=
label_tag
:company_name
,
_
(
'Company name'
),
for: :company_name
,
class:
'col-form-label'
=
label_tag
:company_name
,
_
(
'Company name'
),
for: :company_name
,
class:
'col-form-label'
=
text_field_tag
:company_name
,
params
[
:company_name
]
,
class:
'form-control'
,
required:
true
=
text_field_tag
:company_name
,
params
[
:company_name
]
||
current_user
.
organization
,
class:
'form-control'
,
required:
true
.form-group.gl-select2-html5-required-fix
.form-group.gl-select2-html5-required-fix
=
label_tag
:company_size
,
_
(
'Number of employees'
),
for: :company_size
,
class:
'col-form-label'
=
label_tag
:company_size
,
_
(
'Number of employees'
),
for: :company_size
,
class:
'col-form-label'
=
select_tag
:company_size
,
company_size_options_for_select
(
params
[
:company_size
]),
include_blank:
true
,
class:
'select2'
,
required:
true
=
select_tag
:company_size
,
company_size_options_for_select
(
params
[
:company_size
]),
include_blank:
true
,
class:
'select2'
,
required:
true
...
...
ee/spec/controllers/trials_controller_spec.rb
View file @
55b52046
...
@@ -3,7 +3,14 @@
...
@@ -3,7 +3,14 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
TrialsController
do
RSpec
.
describe
TrialsController
do
let_it_be
(
:user
)
{
create
(
:user
,
email_opted_in:
true
)
}
let_it_be
(
:user
)
{
create
(
:user
,
email_opted_in:
true
,
last_name:
'Doe'
)
}
let_it_be
(
:experiment_user_context
)
do
{
first_name_present:
user
.
first_name
.
present?
,
last_name_present:
user
.
last_name
.
present?
,
company_name_present:
user
.
organization
.
present?
}
end
let
(
:dev_env_or_com
)
{
true
}
let
(
:dev_env_or_com
)
{
true
}
let
(
:logged_in
)
{
true
}
let
(
:logged_in
)
{
true
}
...
@@ -47,6 +54,12 @@ RSpec.describe TrialsController do
...
@@ -47,6 +54,12 @@ RSpec.describe TrialsController do
response
response
end
end
it
'calls record_experiment_user for the remove_known_trial_form_fields experiment'
do
expect
(
controller
).
to
receive
(
:record_experiment_user
).
with
(
:remove_known_trial_form_fields
)
subject
end
it_behaves_like
'an authenticated endpoint'
it_behaves_like
'an authenticated endpoint'
it_behaves_like
'a dot-com only feature'
it_behaves_like
'a dot-com only feature'
end
end
...
@@ -183,6 +196,11 @@ RSpec.describe TrialsController do
...
@@ -183,6 +196,11 @@ RSpec.describe TrialsController do
let
(
:apply_trial_result
)
{
true
}
let
(
:apply_trial_result
)
{
true
}
it
{
is_expected
.
to
redirect_to
(
"/
#{
namespace
.
path
}
?trial=true"
)
}
it
{
is_expected
.
to
redirect_to
(
"/
#{
namespace
.
path
}
?trial=true"
)
}
it
'calls the record conversion method for the remove_known_trial_form_fields experiment'
do
expect
(
controller
).
to
receive
(
:record_experiment_conversion_event
).
with
(
:remove_known_trial_form_fields
)
subject
end
context
'with a new Group'
do
context
'with a new Group'
do
let
(
:post_params
)
{
{
new_group_name:
'GitLab'
}
}
let
(
:post_params
)
{
{
new_group_name:
'GitLab'
}
}
...
@@ -197,6 +215,11 @@ RSpec.describe TrialsController do
...
@@ -197,6 +215,11 @@ RSpec.describe TrialsController do
let
(
:apply_trial_result
)
{
false
}
let
(
:apply_trial_result
)
{
false
}
it
{
is_expected
.
to
render_template
(
:select
)
}
it
{
is_expected
.
to
render_template
(
:select
)
}
it
'does not call the record conversion method for the remove_known_trial_form_fields experiment'
do
expect
(
controller
).
not_to
receive
(
:record_experiment_conversion_event
).
with
(
:remove_known_trial_form_fields
)
subject
end
context
'with a new Group'
do
context
'with a new Group'
do
let
(
:post_params
)
{
{
new_group_name:
'admin'
}
}
let
(
:post_params
)
{
{
new_group_name:
'admin'
}
}
...
...
ee/spec/views/trials/new.html.haml_spec.rb
0 → 100644
View file @
55b52046
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'trials/new.html.haml'
do
include
ApplicationHelper
let_it_be
(
:remove_known_trial_form_fields_enabled
)
{
false
}
let_it_be
(
:user
)
{
build
(
:user
)
}
before
do
allow
(
view
).
to
receive
(
:current_user
)
{
user
}
allow
(
view
).
to
receive
(
:experiment_enabled?
).
with
(
:remove_known_trial_form_fields
).
and_return
(
remove_known_trial_form_fields_enabled
)
render
end
subject
{
rendered
}
it
'has fields for first, last and company names'
do
is_expected
.
to
have_field
(
'first_name'
)
is_expected
.
to
have_field
(
'last_name'
)
is_expected
.
to
have_field
(
'company_name'
)
end
context
'remove_known_trial_form_fields experiment is enabled'
do
let_it_be
(
:remove_known_trial_form_fields_enabled
)
{
true
}
context
'the user has already values in first, last and company names'
do
let_it_be
(
:user
)
{
build
(
:user
,
first_name:
'John'
,
last_name:
'Doe'
,
organization:
'ACME'
)
}
it
'has hidden fields'
do
is_expected
.
to
have_field
(
'first_name'
,
type: :hidden
)
is_expected
.
to
have_field
(
'last_name'
,
type: :hidden
)
is_expected
.
to
have_field
(
'company_name'
,
type: :hidden
)
end
end
context
'the user empty values for first, last and company names'
do
let_it_be
(
:user
)
{
build
(
:user
,
first_name:
''
,
last_name:
''
,
organization:
''
)
}
it
'has fields'
do
is_expected
.
to
have_field
(
'first_name'
)
is_expected
.
to
have_field
(
'last_name'
)
is_expected
.
to
have_field
(
'company_name'
)
end
end
end
end
lib/gitlab/experimentation.rb
View file @
55b52046
...
@@ -80,6 +80,9 @@ module Gitlab
...
@@ -80,6 +80,9 @@ module Gitlab
},
},
jobs_empty_state:
{
jobs_empty_state:
{
tracking_category:
'Growth::Activation::Experiment::JobsEmptyState'
tracking_category:
'Growth::Activation::Experiment::JobsEmptyState'
},
remove_known_trial_form_fields:
{
tracking_category:
'Growth::Conversion::Experiment::RemoveKnownTrialFormFields'
}
}
}.
freeze
}.
freeze
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment