Commit 35f41147 authored by nicolasdular's avatar nicolasdular

Remove paid signup flow feature flag

Removes the paid sign up flow feature flag, which was rolled out
as an experiment. The experiment was successful and already used
for 100% of the users.

The new paid sign up flow is handling subscription purchases via
GitLab by communicating to a customers.gitlab.com API instead of
redirecting users to customers.gitlab.com
parent 3d9ed2b4
...@@ -7,7 +7,6 @@ import SubscriptionDetails from './checkout/subscription_details.vue'; ...@@ -7,7 +7,6 @@ import SubscriptionDetails from './checkout/subscription_details.vue';
import BillingAddress from './checkout/billing_address.vue'; import BillingAddress from './checkout/billing_address.vue';
import PaymentMethod from './checkout/payment_method.vue'; import PaymentMethod from './checkout/payment_method.vue';
import ConfirmOrder from './checkout/confirm_order.vue'; import ConfirmOrder from './checkout/confirm_order.vue';
import Tracking from '~/tracking';
export default { export default {
components: { ProgressBar, SubscriptionDetails, BillingAddress, PaymentMethod, ConfirmOrder }, components: { ProgressBar, SubscriptionDetails, BillingAddress, PaymentMethod, ConfirmOrder },
...@@ -19,15 +18,6 @@ export default { ...@@ -19,15 +18,6 @@ export default {
computed: { computed: {
...mapState(['isNewUser']), ...mapState(['isNewUser']),
}, },
created() {
document.addEventListener('SnowplowInitialized', () => {
Tracking.event('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', {
label: null,
property: null,
value: null,
});
});
},
i18n: { i18n: {
checkout: s__('Checkout|Checkout'), checkout: s__('Checkout|Checkout'),
}, },
......
...@@ -4,7 +4,6 @@ import createFlash from '~/flash'; ...@@ -4,7 +4,6 @@ import createFlash from '~/flash';
import Api from 'ee/api'; import Api from 'ee/api';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
import { STEPS, PAYMENT_FORM_ID } from '../constants'; import { STEPS, PAYMENT_FORM_ID } from '../constants';
import Tracking from '~/tracking';
export const activateStep = ({ commit }, currentStep) => { export const activateStep = ({ commit }, currentStep) => {
if (STEPS.includes(currentStep)) { if (STEPS.includes(currentStep)) {
...@@ -188,8 +187,6 @@ export const confirmOrder = ({ getters, dispatch, commit }) => { ...@@ -188,8 +187,6 @@ export const confirmOrder = ({ getters, dispatch, commit }) => {
if (data.location) { if (data.location) {
dispatch('confirmOrderSuccess', { dispatch('confirmOrderSuccess', {
location: data.location, location: data.location,
plan_id: data.plan_id,
quantity: data.quantity,
}); });
} else { } else {
dispatch('confirmOrderError', JSON.stringify(data.errors)); dispatch('confirmOrderError', JSON.stringify(data.errors));
...@@ -198,13 +195,7 @@ export const confirmOrder = ({ getters, dispatch, commit }) => { ...@@ -198,13 +195,7 @@ export const confirmOrder = ({ getters, dispatch, commit }) => {
.catch(() => dispatch('confirmOrderError')); .catch(() => dispatch('confirmOrderError'));
}; };
export const confirmOrderSuccess = (_, { location, plan_id, quantity }) => { export const confirmOrderSuccess = (_, { location }) => {
Tracking.event('Growth::Acquisition::Experiment::PaidSignUpFlow', 'end', {
label: plan_id,
property: null,
value: quantity,
});
redirectTo(location); redirectTo(location);
}; };
......
...@@ -5,10 +5,6 @@ module EE ...@@ -5,10 +5,6 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
prepended do
before_action :set_frontend_tracking_data, only: [:new]
end
private private
override :user_created_message override :user_created_message
...@@ -39,9 +35,5 @@ module EE ...@@ -39,9 +35,5 @@ module EE
super super
end end
end end
def set_frontend_tracking_data
frontend_experimentation_tracking_data(:paid_signup_flow, 'sign_up_page_view') if params[:redirect_from] == 'checkout'
end
end end
end end
...@@ -6,7 +6,6 @@ class SubscriptionsController < ApplicationController ...@@ -6,7 +6,6 @@ class SubscriptionsController < ApplicationController
content_security_policy do |p| content_security_policy do |p|
next if p.directives.blank? next if p.directives.blank?
next unless Feature.enabled?(:paid_signup_flow)
default_script_src = p.directives['script-src'] || p.directives['default-src'] default_script_src = p.directives['script-src'] || p.directives['default-src']
script_src_values = Array.wrap(default_script_src) | ["'self'", "'unsafe-eval'", 'https://*.zuora.com'] script_src_values = Array.wrap(default_script_src) | ["'self'", "'unsafe-eval'", 'https://*.zuora.com']
...@@ -23,18 +22,10 @@ class SubscriptionsController < ApplicationController ...@@ -23,18 +22,10 @@ class SubscriptionsController < ApplicationController
end end
def new def new
if experiment_enabled?(:paid_signup_flow) return if current_user
track_paid_signup_flow_event('start_experiment') unless experiment_already_started?
store_location_for_user
if current_user redirect_to new_user_registration_path(redirect_from: 'checkout')
track_paid_signup_flow_event('start')
else
store_location_for_user
redirect_to new_user_registration_path(redirect_from: 'checkout')
end
else
redirect_to customer_portal_new_subscription_url
end
end end
def payment_form def payment_form
...@@ -67,16 +58,14 @@ class SubscriptionsController < ApplicationController ...@@ -67,16 +58,14 @@ class SubscriptionsController < ApplicationController
).execute ).execute
if response[:success] if response[:success]
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
redirect_location = if params[:selected_group] redirect_location = if params[:selected_group]
group_path(group) group_path(group)
else else
plan_id, quantity = subscription_params.values_at(:plan_id, :quantity)
edit_subscriptions_group_path(group.path, plan_id: plan_id, quantity: quantity, new_user: params[:new_user]) edit_subscriptions_group_path(group.path, plan_id: plan_id, quantity: quantity, new_user: params[:new_user])
end end
response[:data] = { location: redirect_location, plan_id: plan_id, quantity: quantity } response[:data] = { location: redirect_location }
track_paid_signup_flow_event('end', label: plan_id, value: quantity)
end end
render json: response[:data] render json: response[:data]
...@@ -84,15 +73,6 @@ class SubscriptionsController < ApplicationController ...@@ -84,15 +73,6 @@ class SubscriptionsController < ApplicationController
private private
def track_paid_signup_flow_event(action, label: nil, value: nil)
::Gitlab::Tracking.event(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
action,
label: label,
value: value
)
end
def customer_params def customer_params
params.require(:customer).permit(:country, :address_1, :address_2, :city, :state, :zip_code, :company) params.require(:customer).permit(:country, :address_1, :address_2, :city, :state, :zip_code, :company)
end end
......
---
title: Handle subscription purchase flow via GitLab
merge_request: 30324
author:
type: added
...@@ -42,35 +42,6 @@ describe RegistrationsController do ...@@ -42,35 +42,6 @@ describe RegistrationsController do
end end
end end
describe '#new' do
before do
stub_experiment(signup_flow: true, paid_signup_flow: true)
stub_experiment_for_user(signup_flow: true, paid_signup_flow: true)
end
context 'when not redirected from checkout page' do
it 'does not push tracking data to gon' do
get :new
expect(Gon.tracking_data).to eq(nil)
end
end
context 'when redirect from checkout page' do
it 'pushes tracking data to gon' do
get :new, params: { redirect_from: 'checkout' }
expect(Gon.tracking_data).to include(
{
category: 'Growth::Acquisition::Experiment::PaidSignUpFlow',
action: 'sign_up_page_view',
property: 'experimental_group'
}
)
end
end
end
describe '#welcome' do describe '#welcome' do
subject { get :welcome } subject { get :welcome }
......
...@@ -8,61 +8,26 @@ describe SubscriptionsController do ...@@ -8,61 +8,26 @@ describe SubscriptionsController do
describe 'GET #new' do describe 'GET #new' do
subject { get :new, params: { plan_id: 'bronze_id' } } subject { get :new, params: { plan_id: 'bronze_id' } }
context 'with experiment enabled' do context 'with unauthenticated user' do
before do it { is_expected.to have_gitlab_http_status(:redirect) }
stub_experiment(paid_signup_flow: true) it { is_expected.to redirect_to new_user_registration_path(redirect_from: 'checkout') }
stub_experiment_for_user(paid_signup_flow: true)
end
context 'with unauthenticated user' do
it { is_expected.to have_gitlab_http_status(:redirect) }
it { is_expected.to redirect_to new_user_registration_path(redirect_from: 'checkout') }
it 'stores subscription URL for later' do
subject
expected_subscription_path = new_subscriptions_path(experiment_started: true, plan_id: 'bronze_id')
expect(controller.stored_location_for(:user)).to eq(expected_subscription_path)
end
it 'tracks the event when experiment starts' do
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
subject
end
it 'does not track event when user got redirected to the subscription page again' do
get :new, params: { plan_id: 'bronze_id', experiment_started: 'true' }
expect(Gitlab::Tracking).not_to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
end
end
context 'with authenticated user' do
before do
sign_in(user)
end
it { is_expected.to render_template 'layouts/checkout' } it 'stores subscription URL for later' do
it { is_expected.to render_template :new } subject
it 'tracks the event with the right parameters' do expected_subscription_path = new_subscriptions_path(experiment_started: true, plan_id: 'bronze_id')
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start_experiment', label: nil, value: nil)
expect(Gitlab::Tracking).to receive(:event).with('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', label: nil, value: nil)
subject expect(controller.stored_location_for(:user)).to eq(expected_subscription_path)
end
end end
end end
context 'with experiment disabled' do context 'with authenticated user' do
before do before do
stub_experiment(paid_signup_flow: false) sign_in(user)
stub_experiment_for_user(paid_signup_flow: false)
end end
it { is_expected.to redirect_to "#{EE::SUBSCRIPTIONS_URL}/subscriptions/new?plan_id=bronze_id&transaction=create_subscription" } it { is_expected.to render_template 'layouts/checkout' }
it { is_expected.to render_template :new }
end end
end end
...@@ -149,17 +114,6 @@ describe SubscriptionsController do ...@@ -149,17 +114,6 @@ describe SubscriptionsController do
it 'updates the setup_for_company attribute of the current user' do it 'updates the setup_for_company attribute of the current user' do
expect { subject }.to change { user.reload.setup_for_company }.from(nil).to(true) expect { subject }.to change { user.reload.setup_for_company }.from(nil).to(true)
end end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
'end',
label: 'x',
value: 2
)
subject
end
end end
context 'when not setting up for a company' do context 'when not setting up for a company' do
...@@ -176,17 +130,6 @@ describe SubscriptionsController do ...@@ -176,17 +130,6 @@ describe SubscriptionsController do
it 'does not update the setup_for_company attribute of the current user' do it 'does not update the setup_for_company attribute of the current user' do
expect { subject }.not_to change { user.reload.setup_for_company } expect { subject }.not_to change { user.reload.setup_for_company }
end end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::PaidSignUpFlow',
'end',
label: 'x',
value: 1
)
subject
end
end end
it 'creates a group' do it 'creates a group' do
...@@ -223,13 +166,7 @@ describe SubscriptionsController do ...@@ -223,13 +166,7 @@ describe SubscriptionsController do
it 'returns the group edit location in JSON format' do it 'returns the group edit location in JSON format' do
subject subject
expected_response = { expect(response.body).to eq({ location: "/-/subscriptions/groups/#{group.path}/edit?plan_id=x&quantity=2" }.to_json)
location: "/-/subscriptions/groups/#{group.path}/edit?plan_id=x&quantity=2",
plan_id: 'x',
quantity: 2
}
expect(response.body).to eq(expected_response.to_json)
end end
end end
...@@ -266,13 +203,7 @@ describe SubscriptionsController do ...@@ -266,13 +203,7 @@ describe SubscriptionsController do
it 'returns the selected group location in JSON format' do it 'returns the selected group location in JSON format' do
subject subject
expected_response = { expect(response.body).to eq({ location: "/#{selected_group.path}" }.to_json)
location: "/#{selected_group.path}",
plan_id: 'x',
quantity: 1
}
expect(response.body).to eq(expected_response.to_json)
end end
end end
......
...@@ -9,8 +9,7 @@ describe 'Subscriptions Content Security Policy' do ...@@ -9,8 +9,7 @@ describe 'Subscriptions Content Security Policy' do
let_it_be(:zuora_url) { 'https://*.zuora.com' } let_it_be(:zuora_url) { 'https://*.zuora.com' }
before do before do
stub_experiment_for_user(paid_signup_flow: true, signup_flow: true) stub_experiment_for_user(signup_flow: true)
stub_request(:get, /.*gitlab_plans.*/).to_return(status: 200, body: "{}") stub_request(:get, /.*gitlab_plans.*/).to_return(status: 200, body: "{}")
expect_next_instance_of(SubscriptionsController) do |controller| expect_next_instance_of(SubscriptionsController) do |controller|
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import { mockTracking } from 'helpers/tracking_helper';
import createStore from 'ee/subscriptions/new/store'; import createStore from 'ee/subscriptions/new/store';
import Component from 'ee/subscriptions/new/components/checkout.vue'; import Component from 'ee/subscriptions/new/components/checkout.vue';
import ProgressBar from 'ee/subscriptions/new/components/checkout/progress_bar.vue'; import ProgressBar from 'ee/subscriptions/new/components/checkout/progress_bar.vue';
...@@ -11,7 +10,6 @@ describe('Checkout', () => { ...@@ -11,7 +10,6 @@ describe('Checkout', () => {
let store; let store;
let wrapper; let wrapper;
let spy;
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(Component, { wrapper = shallowMount(Component, {
...@@ -22,7 +20,6 @@ describe('Checkout', () => { ...@@ -22,7 +20,6 @@ describe('Checkout', () => {
const findProgressBar = () => wrapper.find(ProgressBar); const findProgressBar = () => wrapper.find(ProgressBar);
beforeEach(() => { beforeEach(() => {
spy = mockTracking('Growth::Acquisition::Experiment::PaidSignUpFlow', null, jest.spyOn);
store = createStore(); store = createStore();
createComponent(); createComponent();
}); });
...@@ -31,16 +28,6 @@ describe('Checkout', () => { ...@@ -31,16 +28,6 @@ describe('Checkout', () => {
wrapper.destroy(); wrapper.destroy();
}); });
it('sends tracking event when snowplow got initialized', () => {
document.dispatchEvent(new Event('SnowplowInitialized'));
expect(spy).toHaveBeenCalledWith('Growth::Acquisition::Experiment::PaidSignUpFlow', 'start', {
label: null,
property: null,
value: null,
});
});
describe.each([[true, true], [false, false]])('when isNewUser=%s', (isNewUser, visible) => { describe.each([[true, true], [false, false]])('when isNewUser=%s', (isNewUser, visible) => {
beforeEach(() => { beforeEach(() => {
store.state.isNewUser = isNewUser; store.state.isNewUser = isNewUser;
......
import { mockTracking } from 'helpers/tracking_helper';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -588,7 +587,7 @@ describe('Subscriptions Actions', () => { ...@@ -588,7 +587,7 @@ describe('Subscriptions Actions', () => {
describe('confirmOrder', () => { describe('confirmOrder', () => {
it('calls confirmOrderSuccess with a redirect location on success', done => { it('calls confirmOrderSuccess with a redirect location on success', done => {
const response = { location: 'x', plan_id: 'id', quantity: 1 }; const response = { location: 'x' };
mock.onPost(confirmOrderPath).replyOnce(200, response); mock.onPost(confirmOrderPath).replyOnce(200, response);
testAction( testAction(
...@@ -639,20 +638,6 @@ describe('Subscriptions Actions', () => { ...@@ -639,20 +638,6 @@ describe('Subscriptions Actions', () => {
done(); done();
}); });
}); });
it('sends tracking event', done => {
const spy = mockTracking('Growth::Acquisition::Experiment::PaidSignUpFlow', null, jest.spyOn);
jest.spyOn(window.location, 'assign').mockImplementation();
testAction(actions.confirmOrderSuccess, params, {}, [], [], () => {
expect(spy).toHaveBeenCalledWith('Growth::Acquisition::Experiment::PaidSignUpFlow', 'end', {
label: 'x',
property: null,
value: 10,
});
done();
});
});
}); });
describe('confirmOrderError', () => { describe('confirmOrderError', () => {
......
...@@ -25,9 +25,6 @@ module Gitlab ...@@ -25,9 +25,6 @@ module Gitlab
signup_flow: { signup_flow: {
tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow' tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow'
}, },
paid_signup_flow: {
tracking_category: 'Growth::Acquisition::Experiment::PaidSignUpFlow'
},
suggest_pipeline: { suggest_pipeline: {
tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline' tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline'
}, },
......
...@@ -470,8 +470,8 @@ end ...@@ -470,8 +470,8 @@ end
describe 'With experimental flow' do describe 'With experimental flow' do
before do before do
stub_experiment(signup_flow: true, paid_signup_flow: false) stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true, paid_signup_flow: false) stub_experiment_for_user(signup_flow: true)
end end
it_behaves_like 'Signup' it_behaves_like 'Signup'
......
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