Commit fb4dbe27 authored by Alex Buijs's avatar Alex Buijs

Implement feedback fixes

parent 21d707a7
...@@ -16,7 +16,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -16,7 +16,7 @@ class RegistrationsController < Devise::RegistrationsController
def new def new
if experiment_enabled?(:signup_flow) if experiment_enabled?(:signup_flow)
track_experiment_event(:signup_flow, 'start') track_experiment_event(:signup_flow, 'start') # We want this event to be tracked when the user is _in_ the experimental group
@resource = build_resource @resource = build_resource
else else
redirect_to new_user_session_path(anchor: 'register-pane') redirect_to new_user_session_path(anchor: 'register-pane')
...@@ -24,7 +24,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -24,7 +24,7 @@ class RegistrationsController < Devise::RegistrationsController
end end
def create def create
track_experiment_event(:signup_flow, 'end') unless experiment_enabled?(:signup_flow) 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
accept_pending_invitations accept_pending_invitations
...@@ -64,7 +64,7 @@ class RegistrationsController < Devise::RegistrationsController ...@@ -64,7 +64,7 @@ class RegistrationsController < Devise::RegistrationsController
result = ::Users::UpdateService.new(current_user, user_params.merge(user: current_user)).execute result = ::Users::UpdateService.new(current_user, user_params.merge(user: current_user)).execute
if result[:status] == :success if result[:status] == :success
track_experiment_event(:signup_flow, 'end') track_experiment_event(:signup_flow, 'end') # We want this event to be tracked when the user is _in_ the experimental group
set_flash_message! :notice, :signed_up set_flash_message! :notice, :signed_up
redirect_to stored_location_or_dashboard_or_almost_there_path(current_user) redirect_to stored_location_or_dashboard_or_almost_there_path(current_user)
else else
......
...@@ -296,6 +296,7 @@ class SessionsController < Devise::SessionsController ...@@ -296,6 +296,7 @@ class SessionsController < Devise::SessionsController
end end
def frontend_tracking_data 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) frontend_experimentation_tracking_data(:signup_flow, 'start') unless experiment_enabled?(:signup_flow)
end end
end end
......
...@@ -47,17 +47,15 @@ module Gitlab ...@@ -47,17 +47,15 @@ module Gitlab
end end
def track_experiment_event(experiment_key, action) def track_experiment_event(experiment_key, action)
return unless Experimentation.enabled?(experiment_key) track_experiment_event_for(experiment_key, action) do |tracking_data|
::Gitlab::Tracking.event(tracking_data.delete(:category), tracking_data.delete(:action), tracking_data)
tracking_data = experimentation_tracking_data(experiment_key, action) end
::Gitlab::Tracking.event(tracking_data.delete(:category), tracking_data.delete(:action), tracking_data)
end end
def frontend_experimentation_tracking_data(experiment_key, action) def frontend_experimentation_tracking_data(experiment_key, action)
return unless Experimentation.enabled?(experiment_key) track_experiment_event_for(experiment_key, action) do |tracking_data|
gon.push(tracking_data: tracking_data)
tracking_data = experimentation_tracking_data(experiment_key, action) end
gon.push(tracking_data: tracking_data)
end end
private private
...@@ -72,6 +70,12 @@ module Gitlab ...@@ -72,6 +70,12 @@ module Gitlab
experimentation_subject_id.delete('-').hex % 100 experimentation_subject_id.delete('-').hex % 100
end end
def track_experiment_event_for(experiment_key, action)
return unless Experimentation.enabled?(experiment_key)
yield experimentation_tracking_data(experiment_key, action)
end
def experimentation_tracking_data(experiment_key, action) def experimentation_tracking_data(experiment_key, action)
{ {
category: tracking_category(experiment_key), category: tracking_category(experiment_key),
......
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