-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3609 from alphagov/browse_ab_test
Set up AB test logic for NewBrowse
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module NewBrowseAbTestable | ||
# placeholder custom dimension | ||
CUSTOM_DIMENSION = 67 | ||
|
||
ALLOWED_VARIANTS = %w[A B Z].freeze | ||
|
||
def new_browse_test | ||
@new_browse_test ||= GovukAbTesting::AbTest.new( | ||
"NewBrowse", | ||
dimension: CUSTOM_DIMENSION, | ||
allowed_variants: ALLOWED_VARIANTS, | ||
control_variant: "Z", | ||
) | ||
end | ||
|
||
def new_browse_variant | ||
new_browse_test.requested_variant(request.headers) | ||
end | ||
|
||
def set_new_browse_response_header | ||
new_browse_variant.configure_response(response) | ||
end | ||
|
||
def new_browse_variant_b? | ||
page_under_test? && new_browse_variant.variant?("B") | ||
end | ||
|
||
def new_browse_page_under_test? | ||
request.path.starts_with?("/browse") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters