Commit 4ad03a4d authored by Alper Akgun's avatar Alper Akgun Committed by Doug Stull

Redirect in-app trial users to the trial source

parent 3ffa2478
---
name: redirect_trial_user_to_feature
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65450
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/335824
milestone: '14.1'
type: experiment
group: group::conversion
default_enabled: false
......@@ -45,7 +45,11 @@ class TrialsController < ApplicationController
record_experiment_conversion_event(:remove_known_trial_form_fields)
record_experiment_conversion_event(:trial_onboarding_issues)
redirect_to group_url(@namespace, { trial: true })
if discover_group_security_flow?
redirect_trial_user_to_feature_experiment_flow
else
redirect_to group_url(@namespace, { trial: true })
end
else
render :select
end
......@@ -177,4 +181,16 @@ class TrialsController < ApplicationController
company_name_present: current_user.organization.present?
}
end
def redirect_trial_user_to_feature_experiment_flow
experiment(:redirect_trial_user_to_feature, namespace: @namespace) do |e|
e.record!
e.use { redirect_to group_url(@namespace, { trial: true }) }
e.try { redirect_to group_security_dashboard_url(@namespace, { trial: true }) }
end
end
def discover_group_security_flow?
params[:glm_content] == 'discover-group-security'
end
end
......@@ -2,4 +2,5 @@
- page_title _("Security Dashboard")
- add_page_specific_style 'page_bundles/security_dashboard'
= render 'registrations/trial_is_activated_banner' if params[:trial] == 'true'
#js-group-security-dashboard{ data: group_level_security_dashboard_data(@group) }
%section.gl-banner.gl-banner-introduction{ data: { uid: 'trial_success_banner_dismissed' } }
.gl-banner-illustration
= image_tag('illustrations/illustration-congratulation-purchase.svg', alt: s_('Trial|Successful trial activation image'))
.gl-banner-content.gl-my-auto
%h3.gl-banner-title= _('Congratulations, your free trial is activated.')
%button.gl-banner-close.close.js-close-session.js-close-callout{ type: 'button', 'aria-label' => s_('Trial|Dismiss') }
= sprite_icon('close', css_class: 'dismiss-icon')
.row
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.gl-mt-3
%section.gl-banner.gl-banner-introduction{ data: { uid: 'trial_success_banner_dismissed' } }
.gl-banner-illustration
= image_tag('illustrations/illustration-congratulation-purchase.svg', alt: s_('Trial|Successful trial activation image'))
.gl-banner-content.gl-my-auto
%h3.gl-banner-title= _('Congratulations, your free trial is activated.')
%button.gl-banner-close.close.js-close-session.js-close-callout{ type: 'button', 'aria-label' => s_('Trial|Dismiss') }
= sprite_icon('close', css_class: 'dismiss-icon')
- page_title s_('InviteMember|Invite teammates to your GitLab group')
- if in_trial_during_signup_flow? || in_trial_onboarding_flow?
.row
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.gl-mt-3
= render 'registrations/trial_is_activated_banner'
= render 'registrations/trial_is_activated_banner'
.row.gl-flex-grow-1
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.p-3.gl-bg-gray-10
.group-invites.gl-display-flex.gl-flex-direction-column.gl-align-items-center.pt-5
......
......@@ -3,9 +3,7 @@
- visibility_level = selected_visibility_level(@project, params.dig(:project, :visibility_level))
- if !already_showed_trial_activation? && (in_trial_during_signup_flow? || in_trial_onboarding_flow?)
.row
.gl-display-flex.gl-flex-direction-column.gl-align-items-center.gl-w-full.gl-mt-3
= render 'registrations/trial_is_activated_banner'
= render 'registrations/trial_is_activated_banner'
.row.gl-flex-grow-1
.gl-display-flex.gl-align-items-center.gl-flex-direction-column.gl-w-full.gl-px-5.gl-pb-5
.new-project.gl-display-flex.gl-flex-direction-column.gl-align-items-center
......
......@@ -198,6 +198,36 @@ RSpec.describe TrialsController do
subject
end
context 'in discover group security flow' do
let(:post_params) { { namespace_id: namespace.id, glm_content: 'discover-group-security' } }
context 'with redirect_trial_user_to_feature experiment variant' do
before do
stub_experiments(redirect_trial_user_to_feature: :candidate)
end
it { is_expected.to redirect_to(group_security_dashboard_url(namespace, { trial: true })) }
it 'records the subject' do
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: :experimental, subject: namespace)
subject
end
end
context 'with redirect_trial_user_to_feature experiment control' do
before do
stub_experiments(redirect_trial_user_to_feature: :control)
end
it { is_expected.to redirect_to(group_url(namespace, { trial: true })) }
it 'records the subject' do
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: :control, subject: namespace)
subject
end
end
end
context 'with a new Group' do
let(:post_params) { { new_group_name: 'GitLab' } }
......
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