Module: Gitlab::Experimentation

Defined in:
lib/gitlab/experimentation.rb

Defined Under Namespace

Modules: ControllerConcern Classes: Experiment

Constant Summary collapse

EXPERIMENTS =
{
  signup_flow: {
    tracking_category: 'Growth::Acquisition::Experiment::SignUpFlow'
  },
  onboarding_issues: {
    tracking_category: 'Growth::Conversion::Experiment::OnboardingIssues'
  },
  suggest_pipeline: {
    tracking_category: 'Growth::Expansion::Experiment::SuggestPipeline'
  },
  ci_notification_dot: {
    tracking_category: 'Growth::Expansion::Experiment::CiNotificationDot'
  },
  upgrade_link_in_user_menu_a: {
    tracking_category: 'Growth::Expansion::Experiment::UpgradeLinkInUserMenuA'
  },
  invite_members_version_a: {
    tracking_category: 'Growth::Expansion::Experiment::InviteMembersVersionA'
  },
  new_create_project_ui: {
    tracking_category: 'Manage::Import::Experiment::NewCreateProjectUi'
  },
  terms_opt_in: {
    tracking_category: 'Growth::Acquisition::Experiment::TermsOptIn'
  },
  contact_sales_btn_in_app: {
    tracking_category: 'Growth::Conversion::Experiment::ContactSalesInApp'
  },
  customize_homepage: {
    tracking_category: 'Growth::Expansion::Experiment::CustomizeHomepage'
  },
  invite_email: {
    tracking_category: 'Growth::Acquisition::Experiment::InviteEmail'
  }
}.freeze
GROUP_CONTROL =
:control
GROUP_EXPERIMENTAL =
:experimental

Class Method Summary collapse

Class Method Details

.enabled?(experiment_key) ⇒ Boolean

Returns:

  • (Boolean)

179
180
181
182
183
184
# File 'lib/gitlab/experimentation.rb', line 179

def enabled?(experiment_key)
  return false unless EXPERIMENTS.key?(experiment_key)

  experiment = experiment(experiment_key)
  experiment.enabled? && experiment.enabled_for_environment?
end

.enabled_for_user?(experiment_key, experimentation_subject_index) ⇒ Boolean

Returns:

  • (Boolean)

186
187
188
189
# File 'lib/gitlab/experimentation.rb', line 186

def enabled_for_user?(experiment_key, experimentation_subject_index)
  enabled?(experiment_key) &&
    experiment(experiment_key).enabled_for_experimentation_subject?(experimentation_subject_index)
end

.experiment(key) ⇒ Object


175
176
177
# File 'lib/gitlab/experimentation.rb', line 175

def experiment(key)
  Experiment.new(EXPERIMENTS[key].merge(key: key))
end