Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AB test - replace some content on UTR page #2947

Merged
merged 9 commits into from
Oct 18, 2023
28 changes: 28 additions & 0 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ContentItemsController < ApplicationController
def show
load_content_item

temporary_ab_test_find_utr_page
set_expiry

if is_service_manual?
Expand Down Expand Up @@ -266,4 +267,31 @@ 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
5 changes: 5 additions & 0 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
ar:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/az.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
az:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/be.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
be:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/bg.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
bg:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/bn.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
bn:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/cs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
cs:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/cy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
cy:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/da.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
da:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
de:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/dr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
dr:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/el.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
el:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
en:
ab_tests:
find_utr_number_video_links:
A: 'in the <a href="/guidance/download-the-hmrc-app"><abbr title="HM Revenue and Customs">HMRC</abbr> app</a>'
B: 'in the <abbr title="HM Revenue and Customs">HMRC</abbr> app - watch a <a href="https://www.youtube.com/watch?v=LXw9ily9rTo">video about finding your UTR number in the app</a>'
Z: 'in the <a href="/guidance/download-the-hmrc-app"><abbr title="HM Revenue and Customs">HMRC</abbr> app</a>'
call_for_evidence:
and: and
another_website_html: This call for evidence %{closed} held on <a href="%{url}">another website</a>
Expand Down
5 changes: 5 additions & 0 deletions config/locales/es-419.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
es-419:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
es:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/et.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
et:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/fa.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
fa:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
fi:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
fr:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/gd.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
gd:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/gu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
gu:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/he.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
he:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/hi.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
hi:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/hr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
hr:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/hu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
hu:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/hy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
hy:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/id.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
id:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/is.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
is:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
it:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
ja:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/ka.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
ka:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/kk.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
kk:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
5 changes: 5 additions & 0 deletions config/locales/ko.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
ko:
ab_tests:
find_utr_number_video_links:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down
Loading