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
d9db9472
Commit
d9db9472
authored
Jun 09, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track events for onboarding issues experiment
Events tracked: - signed_up - created_namespace
parent
76e12073
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
1 deletion
+113
-1
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+2
-0
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+1
-0
ee/spec/controllers/registrations_controller_spec.rb
ee/spec/controllers/registrations_controller_spec.rb
+50
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+60
-0
No files found.
app/controllers/groups_controller.rb
View file @
d9db9472
...
@@ -57,6 +57,8 @@ class GroupsController < Groups::ApplicationController
...
@@ -57,6 +57,8 @@ class GroupsController < Groups::ApplicationController
@group
=
Groups
::
CreateService
.
new
(
current_user
,
group_params
).
execute
@group
=
Groups
::
CreateService
.
new
(
current_user
,
group_params
).
execute
if
@group
.
persisted?
if
@group
.
persisted?
track_experiment_event
(
:onboarding_issues
,
'created_namespace'
)
notice
=
if
@group
.
chat_team
.
present?
notice
=
if
@group
.
chat_team
.
present?
"Group '
#{
@group
.
name
}
' and its Mattermost team were successfully created."
"Group '
#{
@group
.
name
}
' and its Mattermost team were successfully created."
else
else
...
...
app/controllers/registrations_controller.rb
View file @
d9db9472
...
@@ -69,6 +69,7 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -69,6 +69,7 @@ class RegistrationsController < Devise::RegistrationsController
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
track_experiment_event
(
:signup_flow
,
'end'
)
# We want this event to be tracked when the user is _in_ the experimental group
track_experiment_event
(
:signup_flow
,
'end'
)
# We want this event to be tracked when the user is _in_ the experimental group
track_experiment_event
(
:onboarding_issues
,
'signed_up'
)
if
::
Gitlab
.
com?
&&
!
helpers
.
in_subscription_flow?
&&
!
helpers
.
in_invitation_flow?
return
redirect_to
new_users_sign_up_group_path
if
experiment_enabled?
(
:onboarding_issues
)
&&
!
helpers
.
in_subscription_flow?
&&
!
helpers
.
in_invitation_flow?
return
redirect_to
new_users_sign_up_group_path
if
experiment_enabled?
(
:onboarding_issues
)
&&
!
helpers
.
in_subscription_flow?
&&
!
helpers
.
in_invitation_flow?
set_flash_message!
:notice
,
:signed_up
set_flash_message!
:notice
,
:signed_up
...
...
ee/spec/controllers/registrations_controller_spec.rb
View file @
d9db9472
...
@@ -59,7 +59,7 @@ RSpec.describe RegistrationsController do
...
@@ -59,7 +59,7 @@ RSpec.describe RegistrationsController do
sign_in
(
create
(
:user
))
sign_in
(
create
(
:user
))
end
end
subject
{
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
false
}
}
}
subject
(
:update_registration
)
{
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
'false'
}
}
}
it
{
is_expected
.
to
redirect_to
dashboard_projects_path
}
it
{
is_expected
.
to
redirect_to
dashboard_projects_path
}
...
@@ -86,5 +86,54 @@ RSpec.describe RegistrationsController do
...
@@ -86,5 +86,54 @@ RSpec.describe RegistrationsController do
it
{
is_expected
.
not_to
redirect_to
new_users_sign_up_group_path
}
it
{
is_expected
.
not_to
redirect_to
new_users_sign_up_group_path
}
end
end
end
end
describe
'tracking for the onboarding issues experiment'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:on_gitlab_com
,
:experiment_enabled
,
:in_subscription_flow
,
:in_invitation_flow
,
:experiment_enabled_for_user
,
:expected_tracking
)
do
false
|
false
|
false
|
false
|
true
|
nil
false
|
false
|
false
|
true
|
true
|
nil
false
|
false
|
true
|
false
|
true
|
nil
false
|
false
|
true
|
true
|
true
|
nil
false
|
true
|
false
|
false
|
true
|
nil
false
|
true
|
false
|
true
|
true
|
nil
false
|
true
|
true
|
false
|
true
|
nil
false
|
true
|
true
|
true
|
true
|
nil
true
|
false
|
false
|
false
|
true
|
nil
true
|
false
|
false
|
true
|
true
|
nil
true
|
false
|
true
|
false
|
true
|
nil
true
|
false
|
true
|
true
|
true
|
nil
true
|
true
|
false
|
false
|
true
|
'experimental_group'
true
|
true
|
false
|
false
|
false
|
'control_group'
true
|
true
|
false
|
true
|
true
|
nil
true
|
true
|
true
|
false
|
true
|
nil
true
|
true
|
true
|
true
|
true
|
nil
end
with_them
do
before
do
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
on_gitlab_com
)
stub_experiment
(
onboarding_issues:
experiment_enabled
)
allow
(
controller
.
helpers
).
to
receive
(
:in_subscription_flow?
).
and_return
(
in_subscription_flow
)
allow
(
controller
.
helpers
).
to
receive
(
:in_invitation_flow?
).
and_return
(
in_invitation_flow
)
stub_experiment_for_user
(
onboarding_issues:
experiment_enabled_for_user
)
end
it
'tracks when appropriate'
do
if
expected_tracking
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
'Growth::Conversion::Experiment::OnboardingIssues'
,
'signed_up'
,
label:
anything
,
property:
expected_tracking
)
else
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
end
update_registration
end
end
end
end
end
end
end
spec/controllers/groups_controller_spec.rb
View file @
d9db9472
...
@@ -301,6 +301,66 @@ RSpec.describe GroupsController do
...
@@ -301,6 +301,66 @@ RSpec.describe GroupsController do
end
end
end
end
end
end
describe
'tracking group creation for onboarding issues experiment'
do
before
do
sign_in
(
user
)
end
subject
(
:create_namespace
)
{
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
'new_group'
}
}
}
context
'experiment disabled'
do
before
do
stub_experiment
(
onboarding_issues:
false
)
end
it
'does not track anything'
do
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
create_namespace
end
end
context
'experiment enabled'
do
before
do
stub_experiment
(
onboarding_issues:
true
)
end
context
'and the user is part of the control group'
do
before
do
stub_experiment_for_user
(
onboarding_issues:
false
)
end
it
'tracks the event with the "created_namespace" action with the "control_group" property'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
'Growth::Conversion::Experiment::OnboardingIssues'
,
'created_namespace'
,
label:
anything
,
property:
'control_group'
)
create_namespace
end
end
context
'and the user is part of the experimental group'
do
before
do
stub_experiment_for_user
(
onboarding_issues:
true
)
end
it
'tracks the event with the "created_namespace" action with the "experimental_group" property'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
'Growth::Conversion::Experiment::OnboardingIssues'
,
'created_namespace'
,
label:
anything
,
property:
'experimental_group'
)
create_namespace
end
end
end
end
end
end
describe
'GET #index'
do
describe
'GET #index'
do
...
...
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