Commit 6dc02add authored by Doug Stull's avatar Doug Stull Committed by Bob Van Landuyt

Fixes the use of actor in registrations_group_invite

- before we would get the same user experience for every user
- now we will get it varied by user/percentage enabled.
parent ab3055aa
...@@ -15,7 +15,7 @@ module Registrations ...@@ -15,7 +15,7 @@ module Registrations
result = Members::CreateService.new(current_user, invite_params).execute(group) result = Members::CreateService.new(current_user, invite_params).execute(group)
if result[:status] == :success if result[:status] == :success
experiment(:registrations_group_invite, actor: :user) experiment(:registrations_group_invite, actor: current_user)
.track(:invites_sent, property: group.id.to_s, value: group.members.invite.size) .track(:invites_sent, property: group.id.to_s, value: group.members.invite.size)
end end
......
...@@ -63,7 +63,7 @@ module Registrations ...@@ -63,7 +63,7 @@ module Registrations
record_experiment_conversion_event(:trial_registration_with_social_signin) record_experiment_conversion_event(:trial_registration_with_social_signin)
record_experiment_conversion_event(:trial_onboarding_issues) record_experiment_conversion_event(:trial_onboarding_issues)
experiment(:registrations_group_invite, actor: :user) do |experiment_instance| experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true) } # control experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true) } # control
experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true) } # with separate page experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true) } # with separate page
experiment_instance.track(:created, property: @group.id.to_s) experiment_instance.track(:created, property: @group.id.to_s)
...@@ -79,7 +79,7 @@ module Registrations ...@@ -79,7 +79,7 @@ module Registrations
if experiment_enabled?(:trial_during_signup) if experiment_enabled?(:trial_during_signup)
trial_during_signup_flow trial_during_signup_flow
else else
experiment(:registrations_group_invite, actor: :user) do |experiment_instance| experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
experiment_instance.use { invite_on_create } # control experiment_instance.use { invite_on_create } # control
experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page
experiment_instance.track(:created, property: @group.id.to_s) experiment_instance.track(:created, property: @group.id.to_s)
...@@ -97,7 +97,7 @@ module Registrations ...@@ -97,7 +97,7 @@ module Registrations
if helpers.in_trial_during_signup_flow? if helpers.in_trial_during_signup_flow?
create_lead_and_apply_trial_flow create_lead_and_apply_trial_flow
else else
experiment(:registrations_group_invite, actor: :user) do |experiment_instance| experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # control experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # control
experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page
experiment_instance.track(:created, property: @group.id.to_s) experiment_instance.track(:created, property: @group.id.to_s)
...@@ -109,7 +109,7 @@ module Registrations ...@@ -109,7 +109,7 @@ module Registrations
if create_lead && apply_trial if create_lead && apply_trial
record_experiment_conversion_event(:trial_during_signup) record_experiment_conversion_event(:trial_during_signup)
experiment(:registrations_group_invite, actor: :user) do |experiment_instance| experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # control experiment_instance.use { redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # control
experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page experiment_instance.try(:invite_page) { redirect_to new_users_sign_up_group_invite_path(group_id: @group.id, trial: helpers.in_trial_during_signup_flow?) } # with separate page
experiment_instance.track(:created, property: @group.id.to_s) experiment_instance.track(:created, property: @group.id.to_s)
......
...@@ -25,6 +25,9 @@ module Registrations ...@@ -25,6 +25,9 @@ module Registrations
if @project.saved? if @project.saved?
learn_gitlab_project = create_learn_gitlab_project learn_gitlab_project = create_learn_gitlab_project
experiment(:registrations_group_invite, actor: current_user)
.track(:signup_successful, property: @project.namespace_id.to_s)
if helpers.in_trial_onboarding_flow? if helpers.in_trial_onboarding_flow?
trial_onboarding_context = { trial_onboarding_context = {
namespace_id: learn_gitlab_project.namespace_id, namespace_id: learn_gitlab_project.namespace_id,
...@@ -35,9 +38,6 @@ module Registrations ...@@ -35,9 +38,6 @@ module Registrations
record_experiment_user(:trial_onboarding_issues, trial_onboarding_context) record_experiment_user(:trial_onboarding_issues, trial_onboarding_context)
record_experiment_conversion_event(:trial_onboarding_issues) record_experiment_conversion_event(:trial_onboarding_issues)
experiment(:registrations_group_invite, actor: @project.group)
.track(:signup_successful, property: @project.namespace_id)
redirect_to trial_getting_started_users_sign_up_welcome_path(learn_gitlab_project_id: learn_gitlab_project.id) redirect_to trial_getting_started_users_sign_up_welcome_path(learn_gitlab_project_id: learn_gitlab_project.id)
else else
redirect_to users_sign_up_experience_level_path(namespace_path: @project.namespace) redirect_to users_sign_up_experience_level_path(namespace_path: @project.namespace)
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
- if !in_trial_onboarding_flow? && experiment_enabled?(:trial_during_signup) - if !in_trial_onboarding_flow? && experiment_enabled?(:trial_during_signup)
= render partial: 'shared/groups/trial_form' = render partial: 'shared/groups/trial_form'
- else - else
- experiment(:registrations_group_invite, actor: :user) do |experiment_instance| - experiment(:registrations_group_invite, actor: current_user) do |experiment_instance|
- experiment_instance.use do - experiment_instance.use do
= render partial: 'shared/groups/invite_members' = render partial: 'shared/groups/invite_members'
- experiment_instance.try(:invite_page) {} - experiment_instance.try(:invite_page) {}
......
...@@ -259,7 +259,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -259,7 +259,7 @@ RSpec.describe Registrations::GroupsController do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_any_instance
.with_context(actor: :user) .with_context(actor: user)
subject subject
end end
...@@ -325,7 +325,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -325,7 +325,7 @@ RSpec.describe Registrations::GroupsController do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_any_instance
.with_context(actor: :user) .with_context(actor: user)
subject subject
end end
...@@ -361,7 +361,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -361,7 +361,7 @@ RSpec.describe Registrations::GroupsController do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:created, { property: group.id.to_s }) .to track(:created, { property: group.id.to_s })
.on_any_instance .on_any_instance
.with_context(actor: :user) .with_context(actor: user)
subject subject
end end
......
...@@ -79,6 +79,15 @@ RSpec.describe Registrations::ProjectsController do ...@@ -79,6 +79,15 @@ RSpec.describe Registrations::ProjectsController do
expect(namespace.projects.find_by_name(s_('Learn GitLab'))).to be_import_finished expect(namespace.projects.find_by_name(s_('Learn GitLab'))).to be_import_finished
end end
it 'tracks the registrations_group_invite experiment as expected', :experiment do
expect(experiment(:registrations_group_invite))
.to track(:signup_successful, { property: namespace.id.to_s })
.on_any_instance
.with_context(actor: user)
subject
end
context 'learn gitlab project' do context 'learn gitlab project' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
......
...@@ -83,7 +83,7 @@ RSpec.describe 'view group invites' do ...@@ -83,7 +83,7 @@ RSpec.describe 'view group invites' do
expect(experiment(:registrations_group_invite)) expect(experiment(:registrations_group_invite))
.to track(:invites_sent, { property: group.id.to_s, value: valid_emails.size }) .to track(:invites_sent, { property: group.id.to_s, value: valid_emails.size })
.on_any_instance .on_any_instance
.with_context(actor: :user) .with_context(actor: user)
post_request post_request
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment