Add a/b test for feed style on new users (#20664)

* Add a/b test for feed style on new users

* Add current_user check

* Adjust to not look for current_user right away

* Move field test to the right place
This commit is contained in:
Ben Halpern 2024-02-20 15:43:28 -08:00 committed by GitHub
parent 17d81b6cb1
commit 223fb9cbfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 3 deletions

View file

@ -221,8 +221,6 @@ class ApplicationController < ActionController::Base
helper_method :internal_navigation?
def feed_style_preference
# TODO: Future functionality will let current_user override this value with UX preferences
# if current_user exists and has a different preference.
Settings::UserExperience.feed_style
end
helper_method :feed_style_preference

View file

@ -5,6 +5,7 @@
# @see UserDecorator
# @see ApplicationPolicy
class AsyncInfo
include FieldTest::Helpers
# @api public
#
# Generate a Hash of the relevant user data.
@ -46,7 +47,7 @@ class AsyncInfo
trusted: user.trusted?,
moderator_for_tags: user.moderator_for_tags,
config_body_class: user.config_body_class,
feed_style: feed_style_preference,
feed_style: feed_style_preference_variable(user),
created_at: user.created_at,
admin: user.any_admin?,
policies: [
@ -75,4 +76,12 @@ class AsyncInfo
rescue Pundit::NotAuthorizedError
false
end
def feed_style_preference_variable(user)
after_date = user.registered_at >= Time.zone.parse("2024-02-20")
flag_on = FeatureFlag.enabled?(:feed_style_test_running)
return field_test(:feed_style_20240220, participant: user) if after_date && flag_on
feed_style_preference
end
end

View file

@ -27,6 +27,27 @@
################################################################################
################################################################################
experiments:
feed_style_20240220:
started_at: 2024-02-20
variants:
- basic
- rich
weights:
- 50
- 50
goals:
- user_creates_pageview
- user_creates_article_reaction
- user_creates_comment
- user_views_pages_on_at_least_two_different_days_within_a_week
- user_views_pages_on_at_least_four_different_days_within_a_week
- user_creates_article_reaction_on_four_different_days_within_a_week
- user_creates_comment_on_at_least_four_different_days_within_a_week
- user_views_pages_on_at_least_three_different_hours_within_a_day
- user_views_pages_on_at_least_four_different_hours_within_a_day
- user_views_pages_on_at_least_twelve_different_hours_within_five_days
- user_views_pages_on_at_least_nine_different_days_within_two_weeks
comments_to_display_20240129:
started_at: 2024-01-29
variants: