diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index d83f5d1197..4697318a35 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -24,31 +24,7 @@ class ContentItemsController < ApplicationController def show load_content_item - # TEMPORARY (author: richard.towers, expected end date: November 30 2023) - # Content specific AB test for the Find your UTR number page - placeholder = "{{ab_test_find_utr_number_video_links}}" - if @content_item.base_path == "/find-utr-number" && @content_item.body.include?(placeholder) - ab_test = GovukAbTesting::AbTest.new( - "find_utr_number_video_links", - dimension: 61, # https://docs.google.com/spreadsheets/d/1h4vGXzIbhOWwUzourPLIc8WM-iU1b6WYOVDOZxmU1Uo/edit#gid=254065189&range=69:69 - allowed_variants: %w[A B Z], - control_variant: "Z", - ) - @requested_variant = ab_test.requested_variant(request.headers) - @requested_variant.configure_response(response) - - replacement = case @requested_variant.variant_name - when "A" - I18n.t("ab_tests.find_utr_number_video_links.A") - when "B" - I18n.t("ab_tests.find_utr_number_video_links.B") - else - I18n.t("ab_tests.find_utr_number_video_links.Z") - end - @content_item.body.sub!(placeholder, replacement) - end - # /TEMPORARY - + temporary_ab_test_find_utr_page set_expiry if is_service_manual? @@ -291,4 +267,32 @@ def csp_connect_src @content_item.csp_connect_src end + + # TEMPORARY (author: richard.towers, expected end date: February 2024) + # Content specific AB test for the Find your UTR number page + def temporary_ab_test_find_utr_page + placeholder = "{{ab_test_find_utr_number_video_links}}" + if @content_item.base_path == "/find-utr-number" && @content_item.body.include?(placeholder) + ab_test = GovukAbTesting::AbTest.new( + "find_utr_number_video_links", + dimension: 61, # https://docs.google.com/spreadsheets/d/1h4vGXzIbhOWwUzourPLIc8WM-iU1b6WYOVDOZxmU1Uo/edit#gid=254065189&range=69:69 + allowed_variants: %w[A B Z], + control_variant: "Z", + ) + @requested_variant = ab_test.requested_variant(request.headers) + @requested_variant.configure_response(response) + + replacement = case @requested_variant.variant_name + when "A" + I18n.t("ab_tests.find_utr_number_video_links.A") + when "B" + I18n.t("ab_tests.find_utr_number_video_links.B") + else + I18n.t("ab_tests.find_utr_number_video_links.Z") + end + @content_item.body.sub!(placeholder, replacement) + end + end + # /TEMPORARY + end