Commit 35235c9e authored by Nicolas Dular's avatar Nicolas Dular

Remove signup experiment tracking

Part of ongoing work to remove the signup experiment. This
experiment is over and we're now removing the tracking and later
move the experiment to be the new default.
parent d4640473
import LengthValidator from '~/pages/sessions/new/length_validator'; import LengthValidator from '~/pages/sessions/new/length_validator';
import UsernameValidator from '~/pages/sessions/new/username_validator'; import UsernameValidator from '~/pages/sessions/new/username_validator';
import NoEmojiValidator from '~/emoji/no_emoji_validator'; import NoEmojiValidator from '~/emoji/no_emoji_validator';
import Tracking from '~/tracking';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
new UsernameValidator(); // eslint-disable-line no-new new UsernameValidator(); // eslint-disable-line no-new
new LengthValidator(); // eslint-disable-line no-new new LengthValidator(); // eslint-disable-line no-new
new NoEmojiValidator(); // eslint-disable-line no-new new NoEmojiValidator(); // eslint-disable-line no-new
}); });
document.addEventListener('SnowplowInitialized', () => {
if (gon.tracking_data) {
const { category, action } = gon.tracking_data;
if (category && action) {
Tracking.event(category, action);
}
}
});
...@@ -5,7 +5,6 @@ import NoEmojiValidator from '../../../emoji/no_emoji_validator'; ...@@ -5,7 +5,6 @@ import NoEmojiValidator from '../../../emoji/no_emoji_validator';
import SigninTabsMemoizer from './signin_tabs_memoizer'; import SigninTabsMemoizer from './signin_tabs_memoizer';
import OAuthRememberMe from './oauth_remember_me'; import OAuthRememberMe from './oauth_remember_me';
import preserveUrlFragment from './preserve_url_fragment'; import preserveUrlFragment from './preserve_url_fragment';
import Tracking from '~/tracking';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
new UsernameValidator(); // eslint-disable-line no-new new UsernameValidator(); // eslint-disable-line no-new
...@@ -21,16 +20,3 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -21,16 +20,3 @@ document.addEventListener('DOMContentLoaded', () => {
// redirected to sign-in after attempting to access a protected URL that included a fragment. // redirected to sign-in after attempting to access a protected URL that included a fragment.
preserveUrlFragment(window.location.hash); preserveUrlFragment(window.location.hash);
}); });
export default function trackData() {
if (gon.tracking_data) {
const tab = document.querySelector(".new-session-tabs a[href='#register-pane']");
const { category, action, ...data } = gon.tracking_data;
tab.addEventListener('click', () => {
Tracking.event(category, action, data);
});
}
}
trackData();
...@@ -17,7 +17,6 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -17,7 +17,6 @@ class RegistrationsController < Devise::RegistrationsController
def new def new
if experiment_enabled?(:signup_flow) if experiment_enabled?(:signup_flow)
track_experiment_event(:signup_flow, 'start') # We want this event to be tracked when the user is _in_ the experimental group
track_experiment_event(:terms_opt_in, 'start') track_experiment_event(:terms_opt_in, 'start')
@resource = build_resource @resource = build_resource
...@@ -27,9 +26,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -27,9 +26,7 @@ class RegistrationsController < Devise::RegistrationsController
end end
def create def create
track_experiment_event(:signup_flow, 'end') unless experiment_enabled?(:signup_flow) # We want this event to be tracked when the user is _in_ the control group
track_experiment_event(:terms_opt_in, 'end') track_experiment_event(:terms_opt_in, 'end')
accept_pending_invitations accept_pending_invitations
super do |new_user| super do |new_user|
...@@ -65,8 +62,6 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -65,8 +62,6 @@ class RegistrationsController < Devise::RegistrationsController
result = ::Users::SignupService.new(current_user, user_params).execute result = ::Users::SignupService.new(current_user, user_params).execute
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(:onboarding_issues, 'signed_up') if ::Gitlab.com? && show_onboarding_issues_experiment? track_experiment_event(:onboarding_issues, 'signed_up') if ::Gitlab.com? && show_onboarding_issues_experiment?
return redirect_to new_users_sign_up_group_path if experiment_enabled?(:onboarding_issues) && show_onboarding_issues_experiment? return redirect_to new_users_sign_up_group_path if experiment_enabled?(:onboarding_issues) && show_onboarding_issues_experiment?
......
...@@ -25,7 +25,6 @@ class SessionsController < Devise::SessionsController ...@@ -25,7 +25,6 @@ class SessionsController < Devise::SessionsController
before_action :store_unauthenticated_sessions, only: [:new] before_action :store_unauthenticated_sessions, only: [:new]
before_action :save_failed_login, if: :action_new_and_failed_login? before_action :save_failed_login, if: :action_new_and_failed_login?
before_action :load_recaptcha before_action :load_recaptcha
before_action :frontend_tracking_data, only: [:new]
after_action :log_failed_login, if: :action_new_and_failed_login? after_action :log_failed_login, if: :action_new_and_failed_login?
after_action :verify_known_sign_in, only: [:create] after_action :verify_known_sign_in, only: [:create]
...@@ -292,11 +291,6 @@ class SessionsController < Devise::SessionsController ...@@ -292,11 +291,6 @@ class SessionsController < Devise::SessionsController
"standard" "standard"
end end
end end
def frontend_tracking_data
# We want tracking data pushed to the frontend when the user is _in_ the control group
frontend_experimentation_tracking_data(:signup_flow, 'start') unless experiment_enabled?(:signup_flow)
end
end end
SessionsController.prepend_if_ee('EE::SessionsController') SessionsController.prepend_if_ee('EE::SessionsController')
...@@ -18,16 +18,6 @@ RSpec.describe RegistrationsController do ...@@ -18,16 +18,6 @@ RSpec.describe RegistrationsController do
stub_experiment_for_user(signup_flow: true) stub_experiment_for_user(signup_flow: true)
end end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::SignUpFlow',
'start',
label: anything,
property: 'experimental_group'
)
subject
end
it 'renders new template and sets the resource variable' do it 'renders new template and sets the resource variable' do
expect(subject).to render_template(:new) expect(subject).to render_template(:new)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -41,11 +31,6 @@ RSpec.describe RegistrationsController do ...@@ -41,11 +31,6 @@ RSpec.describe RegistrationsController do
stub_experiment_for_user(signup_flow: false) stub_experiment_for_user(signup_flow: false)
end end
it 'does not track the event' do
expect(Gitlab::Tracking).not_to receive(:event)
subject
end
it 'renders new template and sets the resource variable' do it 'renders new template and sets the resource variable' do
subject subject
expect(response).to have_gitlab_http_status(:found) expect(response).to have_gitlab_http_status(:found)
...@@ -56,13 +41,6 @@ RSpec.describe RegistrationsController do ...@@ -56,13 +41,6 @@ RSpec.describe RegistrationsController do
context 'with sign up flow and terms_opt_in experiment being enabled' do context 'with sign up flow and terms_opt_in experiment being enabled' do
before do before do
stub_experiment(signup_flow: true, terms_opt_in: true) stub_experiment(signup_flow: true, terms_opt_in: true)
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::SignUpFlow',
'start',
label: anything,
property: 'experimental_group'
)
end end
context 'when user is not part of the experiment' do context 'when user is not part of the experiment' do
...@@ -331,35 +309,6 @@ RSpec.describe RegistrationsController do ...@@ -331,35 +309,6 @@ RSpec.describe RegistrationsController do
end end
describe 'tracking data' do describe 'tracking data' do
context 'with the experimental signup flow enabled and the user is part of the control group' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: false)
end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::SignUpFlow',
'end',
label: anything,
property: 'control_group'
)
post :create, params: user_params
end
end
context 'with the experimental signup flow enabled and the user is part of the experimental group' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true)
end
it 'does not track the event' do
expect(Gitlab::Tracking).not_to receive(:event)
post :create, params: user_params
end
end
context 'with sign up flow and terms_opt_in experiment being enabled' do context 'with sign up flow and terms_opt_in experiment being enabled' do
subject { post :create, params: user_params } subject { post :create, params: user_params }
...@@ -506,24 +455,6 @@ RSpec.describe RegistrationsController do ...@@ -506,24 +455,6 @@ RSpec.describe RegistrationsController do
end end
end end
describe '#update_registration' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: true)
sign_in(create(:user))
end
it 'tracks the event with the right parameters' do
expect(Gitlab::Tracking).to receive(:event).with(
'Growth::Acquisition::Experiment::SignUpFlow',
'end',
label: anything,
property: 'experimental_group'
)
patch :update_registration, params: { user: { role: 'software_developer', setup_for_company: 'false' } }
end
end
describe '#welcome' do describe '#welcome' do
subject { get :welcome } subject { get :welcome }
......
...@@ -59,39 +59,6 @@ RSpec.describe SessionsController do ...@@ -59,39 +59,6 @@ RSpec.describe SessionsController do
end end
end end
end end
describe 'tracking data' do
context 'when the user is part of the experimental group' do
before do
stub_experiment_for_user(signup_flow: true)
end
it 'doesn\'t pass tracking parameters to the frontend' do
get(:new)
expect(Gon.tracking_data).to be_nil
end
end
context 'with the experimental signup flow enabled and the user is part of the control group' do
before do
stub_experiment(signup_flow: true)
stub_experiment_for_user(signup_flow: false)
allow_any_instance_of(described_class).to receive(:experimentation_subject_id).and_return('uuid')
end
it 'passes the right tracking parameters to the frontend' do
get(:new)
expect(Gon.tracking_data).to eq(
{
category: 'Growth::Acquisition::Experiment::SignUpFlow',
action: 'start',
label: 'uuid',
property: 'control_group'
}
)
end
end
end
end end
describe '#create' do describe '#create' do
......
import AccessorUtilities from '~/lib/utils/accessor'; import AccessorUtilities from '~/lib/utils/accessor';
import SigninTabsMemoizer from '~/pages/sessions/new/signin_tabs_memoizer'; import SigninTabsMemoizer from '~/pages/sessions/new/signin_tabs_memoizer';
import trackData from '~/pages/sessions/new/index';
import Tracking from '~/tracking';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
useLocalStorageSpy(); useLocalStorageSpy();
...@@ -99,50 +97,6 @@ describe('SigninTabsMemoizer', () => { ...@@ -99,50 +97,6 @@ describe('SigninTabsMemoizer', () => {
}); });
}); });
describe('trackData', () => {
beforeEach(() => {
jest.spyOn(Tracking, 'event').mockImplementation(() => {});
});
describe('with tracking data', () => {
beforeEach(() => {
gon.tracking_data = {
category: 'Growth::Acquisition::Experiment::SignUpFlow',
action: 'start',
label: 'uuid',
property: 'control_group',
};
trackData();
});
it('should track data when the "click" event of the register tab is triggered', () => {
document.querySelector('a[href="#register-pane"]').click();
expect(Tracking.event).toHaveBeenCalledWith(
'Growth::Acquisition::Experiment::SignUpFlow',
'start',
{
label: 'uuid',
property: 'control_group',
},
);
});
});
describe('without tracking data', () => {
beforeEach(() => {
gon.tracking_data = undefined;
trackData();
});
it('should not track data when the "click" event of the register tab is triggered', () => {
document.querySelector('a[href="#register-pane"]').click();
expect(Tracking.event).not.toHaveBeenCalled();
});
});
});
describe('saveData', () => { describe('saveData', () => {
beforeEach(() => { beforeEach(() => {
memo = { memo = {
......
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