Commit fb4dbe27 authored by Alex Buijs's avatar Alex Buijs

Implement feedback fixes

parent 21d707a7
......@@ -16,7 +16,7 @@ class RegistrationsController < Devise::RegistrationsController
def new
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
else
redirect_to new_user_session_path(anchor: 'register-pane')
......@@ -24,7 +24,7 @@ class RegistrationsController < Devise::RegistrationsController
end
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
......@@ -64,7 +64,7 @@ class RegistrationsController < Devise::RegistrationsController
result = ::Users::UpdateService.new(current_user, user_params.merge(user: current_user)).execute
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
redirect_to stored_location_or_dashboard_or_almost_there_path(current_user)
else
......
......@@ -296,6 +296,7 @@ class SessionsController < Devise::SessionsController
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
......
......@@ -47,17 +47,15 @@ module Gitlab
end
def track_experiment_event(experiment_key, action)
return unless Experimentation.enabled?(experiment_key)
tracking_data = experimentation_tracking_data(experiment_key, action)
::Gitlab::Tracking.event(tracking_data.delete(:category), tracking_data.delete(:action), tracking_data)
track_experiment_event_for(experiment_key, action) do |tracking_data|
::Gitlab::Tracking.event(tracking_data.delete(:category), tracking_data.delete(:action), tracking_data)
end
end
def frontend_experimentation_tracking_data(experiment_key, action)
return unless Experimentation.enabled?(experiment_key)
tracking_data = experimentation_tracking_data(experiment_key, action)
gon.push(tracking_data: tracking_data)
track_experiment_event_for(experiment_key, action) do |tracking_data|
gon.push(tracking_data: tracking_data)
end
end
private
......@@ -72,6 +70,12 @@ module Gitlab
experimentation_subject_id.delete('-').hex % 100
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)
{
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