Commit 39a90e95 authored by Alper Akgun's avatar Alper Akgun

Trial onboarding for trial registrations

Changelog: added
EE: true
parent 4ad862fa
...@@ -64,9 +64,7 @@ module Registrations ...@@ -64,9 +64,7 @@ module Registrations
def apply_trial_for_trial_onboarding_flow def apply_trial_for_trial_onboarding_flow
if apply_trial if apply_trial
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @group.id) record_experiment_user(:remove_known_trial_form_fields, namespace_id: @group.id)
record_experiment_user(:trial_onboarding_issues, namespace_id: @group.id)
record_experiment_conversion_event(:remove_known_trial_form_fields) record_experiment_conversion_event(:remove_known_trial_form_fields)
record_experiment_conversion_event(:trial_onboarding_issues)
redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true) redirect_to new_users_sign_up_project_path(namespace_id: @group.id, trial: helpers.in_trial_during_signup_flow?, trial_onboarding_flow: true)
else else
......
...@@ -38,9 +38,6 @@ module Registrations ...@@ -38,9 +38,6 @@ module Registrations
.track(:create_project, namespace: @project.namespace, project: @project, user: current_user) .track(:create_project, namespace: @project.namespace, project: @project, user: current_user)
if helpers.in_trial_onboarding_flow? if helpers.in_trial_onboarding_flow?
record_experiment_user(:trial_onboarding_issues, onboarding_context)
record_experiment_conversion_event(:trial_onboarding_issues)
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
record_experiment_user(:learn_gitlab_a, onboarding_context) record_experiment_user(:learn_gitlab_a, onboarding_context)
......
...@@ -27,12 +27,11 @@ class TrialsController < ApplicationController ...@@ -27,12 +27,11 @@ class TrialsController < ApplicationController
render(:new) && return unless @result[:success] render(:new) && return unless @result[:success]
if params[:glm_source] == 'about.gitlab.com' if params[:glm_source] == 'about.gitlab.com'
record_experiment_user(:trial_onboarding_issues) redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true)))
return redirect_to(new_users_sign_up_group_path(url_params.merge(trial_onboarding_flow: true))) if experiment_enabled?(:trial_onboarding_issues) else
end
redirect_to select_trials_url(url_params) redirect_to select_trials_url(url_params)
end end
end
def apply def apply
return render(:select) if @namespace.invalid? return render(:select) if @namespace.invalid?
...@@ -41,9 +40,7 @@ class TrialsController < ApplicationController ...@@ -41,9 +40,7 @@ class TrialsController < ApplicationController
if @result&.dig(:success) if @result&.dig(:success)
record_experiment_user(:remove_known_trial_form_fields, namespace_id: @namespace.id) record_experiment_user(:remove_known_trial_form_fields, namespace_id: @namespace.id)
record_experiment_user(:trial_onboarding_issues, namespace_id: @namespace.id)
record_experiment_conversion_event(:remove_known_trial_form_fields) record_experiment_conversion_event(:remove_known_trial_form_fields)
record_experiment_conversion_event(:trial_onboarding_issues)
experiment(:force_company_trial, user: current_user).track(:create_trial, namespace: @namespace, user: current_user, label: 'trials_controller') if @namespace.created_at > 24.hours.ago experiment(:force_company_trial, user: current_user).track(:create_trial, namespace: @namespace, user: current_user, label: 'trials_controller') if @namespace.created_at > 24.hours.ago
......
---
name: trial_onboarding_issues_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48052
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/276703
milestone: '13.8'
type: experiment
group: group::conversion
default_enabled: false
...@@ -102,7 +102,6 @@ RSpec.describe Registrations::GroupsController do ...@@ -102,7 +102,6 @@ RSpec.describe Registrations::GroupsController do
describe 'POST #create', :aggregate_failure do describe 'POST #create', :aggregate_failure do
let_it_be(:glm_params) { {} } let_it_be(:glm_params) { {} }
let_it_be(:trial_form_params) { { trial: 'false' } } let_it_be(:trial_form_params) { { trial: 'false' } }
let_it_be(:trial_onboarding_issues_enabled) { false }
let_it_be(:trial_onboarding_flow_params) { {} } let_it_be(:trial_onboarding_flow_params) { {} }
let(:dev_env_or_com) { true } let(:dev_env_or_com) { true }
...@@ -121,7 +120,6 @@ RSpec.describe Registrations::GroupsController do ...@@ -121,7 +120,6 @@ RSpec.describe Registrations::GroupsController do
context 'with an authenticated user' do context 'with an authenticated user' do
before do before do
sign_in(user) sign_in(user)
stub_experiment_for_subject(trial_onboarding_issues: trial_onboarding_issues_enabled)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
end end
...@@ -144,10 +142,9 @@ RSpec.describe Registrations::GroupsController do ...@@ -144,10 +142,9 @@ RSpec.describe Registrations::GroupsController do
subject subject
end end
context 'when the trial onboarding is active - apply_trial_for_trial_onboarding_flow' do context 'when in trial onboarding - apply_trial_for_trial_onboarding_flow' do
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let_it_be(:trial_onboarding_flow_params) { { trial_onboarding_flow: true, glm_source: 'about.gitlab.com', glm_content: 'content' } } let_it_be(:trial_onboarding_flow_params) { { trial_onboarding_flow: true, glm_source: 'about.gitlab.com', glm_content: 'content' } }
let_it_be(:trial_onboarding_issues_enabled) { true }
let_it_be(:apply_trial_params) do let_it_be(:apply_trial_params) do
{ {
uid: user.id, uid: user.id,
...@@ -175,9 +172,7 @@ RSpec.describe Registrations::GroupsController do ...@@ -175,9 +172,7 @@ RSpec.describe Registrations::GroupsController do
expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true }) expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true })
end end
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: group.id) expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: group.id)
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues, namespace_id: group.id)
expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields) expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
end end
context 'with redirection to projects page' do context 'with redirection to projects page' do
......
...@@ -66,7 +66,6 @@ RSpec.describe Registrations::ProjectsController do ...@@ -66,7 +66,6 @@ RSpec.describe Registrations::ProjectsController do
end end
context 'with an authenticated user', :sidekiq_inline do context 'with an authenticated user', :sidekiq_inline do
let_it_be(:trial_onboarding_issues_enabled) { true }
let_it_be(:first_project) { create(:project) } let_it_be(:first_project) { create(:project) }
let_it_be(:onboarding_context) do let_it_be(:onboarding_context) do
{ learn_gitlab_project_id: project.id, namespace_id: project.namespace_id, project_id: first_project.id } { learn_gitlab_project_id: project.id, namespace_id: project.namespace_id, project_id: first_project.id }
...@@ -75,7 +74,6 @@ RSpec.describe Registrations::ProjectsController do ...@@ -75,7 +74,6 @@ RSpec.describe Registrations::ProjectsController do
before do before do
namespace.add_owner(user) namespace.add_owner(user)
sign_in(user) sign_in(user)
stub_experiment_for_subject(trial_onboarding_issues: trial_onboarding_issues_enabled)
allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com) allow(::Gitlab).to receive(:dev_env_or_com?).and_return(dev_env_or_com)
end end
...@@ -151,7 +149,6 @@ RSpec.describe Registrations::ProjectsController do ...@@ -151,7 +149,6 @@ RSpec.describe Registrations::ProjectsController do
context 'when the trial onboarding is active' do context 'when the trial onboarding is active' do
let_it_be(:trial_onboarding_flow_params) { { trial_onboarding_flow: true } } let_it_be(:trial_onboarding_flow_params) { { trial_onboarding_flow: true } }
let_it_be(:trial_onboarding_issues_enabled) { true }
it 'creates a new project, a "Learn GitLab - Ultimate trial" project, does not set a cookie' do it 'creates a new project, a "Learn GitLab - Ultimate trial" project, does not set a cookie' do
expect { subject }.to change { namespace.projects.pluck(:name) }.from([]).to(['New project', s_('Learn GitLab - Ultimate trial')]) expect { subject }.to change { namespace.projects.pluck(:name) }.from([]).to(['New project', s_('Learn GitLab - Ultimate trial')])
...@@ -166,8 +163,6 @@ RSpec.describe Registrations::ProjectsController do ...@@ -166,8 +163,6 @@ RSpec.describe Registrations::ProjectsController do
expect_next_instance_of(::Projects::GitlabProjectsImportService) do |service| expect_next_instance_of(::Projects::GitlabProjectsImportService) do |service|
expect(service).to receive(:execute).and_return(project) expect(service).to receive(:execute).and_return(project)
end end
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues, onboarding_context)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
expect(subject).to redirect_to(trial_getting_started_users_sign_up_welcome_path(learn_gitlab_project_id: project.id)) expect(subject).to redirect_to(trial_getting_started_users_sign_up_welcome_path(learn_gitlab_project_id: project.id))
end end
end end
......
...@@ -90,24 +90,11 @@ RSpec.describe TrialsController do ...@@ -90,24 +90,11 @@ RSpec.describe TrialsController do
context 'coming from about.gitlab.com' do context 'coming from about.gitlab.com' do
let(:post_params) { { glm_source: 'about.gitlab.com' } } let(:post_params) { { glm_source: 'about.gitlab.com' } }
it 'records trial_onboarding_issues experiment users but does not redirect to onboarding' do it 'redirects to trial onboarding' do
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues)
is_expected.to redirect_to(select_trials_url(glm_source: 'about.gitlab.com'))
end
context 'when experiment trial_onboarding_issues is enabled' do
before do
stub_experiment_for_subject(trial_onboarding_issues: true)
end
it 'records trial_onboarding_issues experiment users and redirects to onboarding' do
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues)
is_expected.to redirect_to(new_users_sign_up_group_path(glm_source: 'about.gitlab.com', trial_onboarding_flow: true)) is_expected.to redirect_to(new_users_sign_up_group_path(glm_source: 'about.gitlab.com', trial_onboarding_flow: true))
end end
end end
end end
end
context 'on failure' do context 'on failure' do
let(:create_lead_result) { false } let(:create_lead_result) { false }
...@@ -191,9 +178,7 @@ RSpec.describe TrialsController do ...@@ -191,9 +178,7 @@ RSpec.describe TrialsController do
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 experiments' do it 'calls the record conversion method for the experiments' do
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: namespace.id) expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, namespace_id: namespace.id)
expect(controller).to receive(:record_experiment_user).with(:trial_onboarding_issues, namespace_id: namespace.id)
expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields) expect(controller).to receive(:record_experiment_conversion_event).with(:remove_known_trial_form_fields)
expect(controller).to receive(:record_experiment_conversion_event).with(:trial_onboarding_issues)
expect(experiment(:force_company_trial)).to track(:create_trial, namespace: namespace, user: user, label: 'trials_controller').with_context(user: user).on_next_instance expect(experiment(:force_company_trial)).to track(:create_trial, namespace: namespace, user: user, label: 'trials_controller').with_context(user: user).on_next_instance
subject subject
......
...@@ -52,9 +52,6 @@ module Gitlab ...@@ -52,9 +52,6 @@ module Gitlab
tracking_category: 'Growth::Conversion::Experiment::ShowTrialStatusInSidebar', tracking_category: 'Growth::Conversion::Experiment::ShowTrialStatusInSidebar',
rollout_strategy: :group rollout_strategy: :group
}, },
trial_onboarding_issues: {
tracking_category: 'Growth::Conversion::Experiment::TrialOnboardingIssues'
},
learn_gitlab_a: { learn_gitlab_a: {
tracking_category: 'Growth::Conversion::Experiment::LearnGitLabA', tracking_category: 'Growth::Conversion::Experiment::LearnGitLabA',
rollout_strategy: :user rollout_strategy: :user
......
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