Skip to content

Commit

Permalink
ACB/DT - Add AB tests to
Browse files Browse the repository at this point in the history
- log-in-file-self-assessment-tax-return
- pay-self-assessment-tax-bill/pay-weekly-monthly
- stop-being-self-employed
  • Loading branch information
Ana Botto authored and davidtrussler committed Dec 22, 2023
1 parent c1949ec commit edb190c
Show file tree
Hide file tree
Showing 70 changed files with 9,367 additions and 1,127 deletions.
75 changes: 75 additions & 0 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def show
load_content_item

temporary_ab_test_find_utr_page
temporary_ab_test_stop_self_employed
temporary_ab_test_sa_video_return_1
temporary_ab_test_sa_video_pay_bill
set_expiry

if is_service_manual?
Expand Down Expand Up @@ -293,5 +296,77 @@ def temporary_ab_test_find_utr_page
@content_item.body.sub!(placeholder, replacement)
end
end

def temporary_ab_test_stop_self_employed
placeholder = "{{ab_test_sa_video_stop_self_employed}}"
if @content_item.base_path == "/stop-being-self-employed" && @content_item.body.include?(placeholder)
ab_test = GovukAbTesting::AbTest.new(
"SAVideoStopSelfEmployed",
dimension: 47, # 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.sa_video_stop_self_employed.A")
when "B"
I18n.t("ab_tests.sa_video_stop_self_employed.B")
else
I18n.t("ab_tests.sa_video_stop_self_employed.Z")
end
@content_item.body.sub!(placeholder, replacement)
end
end

def temporary_ab_test_sa_video_return_1
placeholder = "{{ab_test_sa_video_return_1}}"
if @content_item.base_path == "/log-in-file-self-assessment-tax-return" && @content_item.body.include?(placeholder)
ab_test = GovukAbTesting::AbTest.new(
"SAVideoReturn1",
dimension: 47,
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.sa_video_return_1.A")
when "B"
I18n.t("ab_tests.sa_video_return_1.B")
else
I18n.t("ab_tests.sa_video_return_1.Z")
end
@content_item.body.sub!(placeholder, replacement)
end
end

def temporary_ab_test_sa_video_pay_bill
placeholder = "{{ab_test_sa_video_pay_bill}}"
if @content_item.base_path == "/pay-self-assessment-tax-bill/pay-weekly-monthly" && @content_item.body.include?(placeholder)
ab_test = GovukAbTesting::AbTest.new(
"SAVideoPayBill",
dimension: 47,
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.sa_video_pay_bill.A")
when "B"
I18n.t("ab_tests.sa_video_pay_bill.B")
else
I18n.t("ab_tests.sa_video_pay_bill.Z")
end
@content_item.body.sub!(placeholder, replacement)
end
end
# /TEMPORARY
end
2 changes: 2 additions & 0 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
<% if ga4_scroll_track_headings_paths.include?(full_url) %>
<meta name="govuk:scroll-tracker" content="" data-module="ga4-scroll-tracker"/>
<% end %>

<%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %>
<% end %>

<% unless @content_item.requesting_a_part? %>
Expand Down
29 changes: 12 additions & 17 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ ar:
A:
B:
Z:
sa_video_pay_bill:
A:
B:
Z:
sa_video_return_1:
A:
B:
Z:
sa_video_stop_self_employed:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down Expand Up @@ -681,7 +693,6 @@ ar:
neighbourhood_watch:
open_consultations:
page_heading:
page_title:
petition_paragraph:
body_html:
create_a_petition:
Expand Down Expand Up @@ -839,31 +850,15 @@ ar:
proposed_date: الإصدار المقترح
reason_for_change: سبب التغيير
release_date: تاريخ الإصدار
time:
formats:
short_ordinal: "%e %B %Y"
travel_advice:
alert_status:
avoid_all_but_essential_travel_to_parts_html: ينصح <abbr title="Foreign and Commonwealth Office">FCO</abbr> بعدم السفر إلى بعض أجزاء البلد إلا للضرورة.
avoid_all_but_essential_travel_to_whole_country_html: ينصح <abbr title="Foreign and Commonwealth Office">FCO</abbr> بعد السفر إلى جميع أنحاء البلد إلا للضرورة.
avoid_all_travel_to_parts_html: ينصح <abbr title="Foreign and Commonwealth Office">FCO</abbr> بعدم السفر إلى بعض أجزاء البلد.
avoid_all_travel_to_whole_country_html: ينصح <abbr title="Foreign and Commonwealth Office">FCO</abbr> بعدم السفر إلى جميع أنحاء البلد.
context: نصائح السفر إلى الخارج
pages:
still_current_at: لا يزال ساريًا في
summary: ملخص
updated: تاريخ التحديث
working_group:
contact_details: تفاصيل جهة الاتصال
policies: سياسات
worldwide_organisation:
corporate_information:
about_our_services_html: تعرف على %{link}.
personal_information_charter_html: يوضح %{link} كيف نتعامل مع معلوماتك الشخصية.
publication_scheme_html: اقرأ عن أنواع المعلومات التي ننشرها بشكل روتيني في %{link}.
social_media_use_html: اقرأ سياستنا على %{link}.
welsh_language_scheme_html: تعرف على التزامنا بشأن %{link}.
find_out_more: اطلع على الملف الكامل وجميع تفاصيل الاتصال
headings:
contact_us: اتصل بنا
corporate_information: معلومات الشركة
Expand Down
29 changes: 12 additions & 17 deletions config/locales/az.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ az:
A:
B:
Z:
sa_video_pay_bill:
A:
B:
Z:
sa_video_return_1:
A:
B:
Z:
sa_video_stop_self_employed:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down Expand Up @@ -373,7 +385,6 @@ az:
neighbourhood_watch:
open_consultations:
page_heading:
page_title:
petition_paragraph:
body_html:
create_a_petition:
Expand Down Expand Up @@ -527,31 +538,15 @@ az:
proposed_date: Təklif edilmiş buraxılış
reason_for_change: Dəyişikliyin səbəbi
release_date: Buraxılış tarixi
time:
formats:
short_ordinal: "%e %B %Y"
travel_advice:
alert_status:
avoid_all_but_essential_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> ölkənin bölgələrinə zəruri səyahət istisna olmaqla heç birini məsləhət görmürlər.
avoid_all_but_essential_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> ölkəyə ümumi zəruri səyahət istisna olmaqla heç birini məsləhət görmürlər.
avoid_all_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> ölkənin bölgələrinə bütün səyahətləri məsləhət görmürlər.
avoid_all_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> ölkəyə ümumilikdə bütün səyahətləri məsləhət görmürlər.
context: Xaricə səyahət üzrə məsləhət
pages:
still_current_at: Hələ də qüvvədədir
summary: İcmal
updated: Yenilənib
working_group:
contact_details: Əlaqə məlumatları
policies: Siyasətlər
worldwide_organisation:
corporate_information:
about_our_services_html: Öyrənin %{link}.
personal_information_charter_html: Bizim %{link} şəxsi məlumatlarınızla necə davrandığımızı izah edir.
publication_scheme_html: "%{link}-də adətən istifadə etdiyimiz məlumatların növləri barədə oxuyun."
social_media_use_html: "%{link}-də siyasətmizi oxuyun."
welsh_language_scheme_html: "%{link} ilə bağlı öhdəliyimiz barədə öyrənin."
find_out_more: Tam profil və əlaqə məlumatlarımıza baxın
headings:
contact_us: Bizimlə əlaqə saxlayın
corporate_information: Korporativ məlumat
Expand Down
29 changes: 12 additions & 17 deletions config/locales/be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ be:
A:
B:
Z:
sa_video_pay_bill:
A:
B:
Z:
sa_video_return_1:
A:
B:
Z:
sa_video_stop_self_employed:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down Expand Up @@ -527,7 +539,6 @@ be:
neighbourhood_watch:
open_consultations:
page_heading:
page_title:
petition_paragraph:
body_html:
create_a_petition:
Expand Down Expand Up @@ -683,31 +694,15 @@ be:
proposed_date: Прапанаваны рэліз
reason_for_change: Прычына змены
release_date: Дата рэлізу
time:
formats:
short_ordinal: "%e %B %Y"
travel_advice:
alert_status:
avoid_all_but_essential_travel_to_parts_html: Міністэрства замежных спраў і па справах Садружнасці <abbr title="Foreign and Commonwealth Office">FCO</abbr> раяць устрымацца ад усіх падарожжаў, апроч самых патрэбных, у некаторыя раёны краіны.
avoid_all_but_essential_travel_to_whole_country_html: Міністэрства замежных спраў і па справах Садружнасці <abbr title="Foreign and Commonwealth Office">FCO</abbr> раяць устрымацца ад усіх падарожжаў, апроч самых патрэбных, у некаторыя раёны краіны.
avoid_all_travel_to_parts_html: Міністэрства замежных спраў і па справах Садружнасці <abbr title="Foreign and Commonwealth Office">FCO</abbr> раяць устрымацца ад усіх падарожжаў, апроч самых патрэбных, у некаторыя раёны краіны.
avoid_all_travel_to_whole_country_html: Міністэрства замежных спраў і па справах Садружнасці <abbr title="Foreign and Commonwealth Office">FCO</abbr> раяць устрымацца ад усіх падарожжаў, апроч самых патрэбных, у некаторыя раёны краіны.
context: Рады па замежных падарожжах
pages:
still_current_at: Усё яшчэ актуальна
summary: Рэзюмэ
updated: Адноўлена
working_group:
contact_details: Кантактныя дадзеныя
policies: Напрамкі дзейнасці
worldwide_organisation:
corporate_information:
about_our_services_html: Даведайцеся %{link}.
personal_information_charter_html: Наша %{link} тлумачыць, як мы ставімся да Вашай асабістай інфармацыі.
publication_scheme_html: Чытайце пра тыпы інфармацыі, якую мы рэгулярна публікуем, у нашым %{link}.
social_media_use_html: Прачытайце пра нашу палітыку датычна %{link}.
welsh_language_scheme_html: Даведайцеся аб нашых абавязках да публікацыі ў %{link}.
find_out_more: Паглядзець усю інфармацыю і кантактныя дадзеныя
headings:
contact_us: Звяжыцеся з намі
corporate_information: Карпаратыўная іфармацыя
Expand Down
29 changes: 12 additions & 17 deletions config/locales/bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ bg:
A:
B:
Z:
sa_video_pay_bill:
A:
B:
Z:
sa_video_return_1:
A:
B:
Z:
sa_video_stop_self_employed:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down Expand Up @@ -373,7 +385,6 @@ bg:
neighbourhood_watch:
open_consultations:
page_heading:
page_title:
petition_paragraph:
body_html:
create_a_petition:
Expand Down Expand Up @@ -527,31 +538,15 @@ bg:
proposed_date: Предложено издание
reason_for_change: Причина за промяната
release_date: Дата на издаване
time:
formats:
short_ordinal: "%e %B %Y"
travel_advice:
alert_status:
avoid_all_but_essential_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> препоръчва да не се пътува до някои части на страната, освен ако това не е необходимо.
avoid_all_but_essential_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> препоръчва да не се пътува из цялата страна, освен ако не е необходимо.
avoid_all_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> препоръчва да не се пътува до някои части на страната.
avoid_all_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> препоръчва да не се пътува из цялата страна.
context: Съвети при пътуване в чужбина
pages:
still_current_at: Все още актуален в
summary: Обобщение
updated: Актуализиран
working_group:
contact_details: Данни за контакти
policies: Политики
worldwide_organisation:
corporate_information:
about_our_services_html: Научете повече за %{link}.
personal_information_charter_html: В нашия %{link} е обяснено как работим с личната информация.
publication_scheme_html: Прочетете за видовете информация, които обичайно публикуваме на нашата %{link}.
social_media_use_html: Прочетете нашите правила на %{link}.
welsh_language_scheme_html: Научете повече за нашия ангажимент към %{link}.
find_out_more: Вижте пълния профил и всички данни за контакт
headings:
contact_us: Свържете се с нас
corporate_information: Фирмена информация
Expand Down
29 changes: 12 additions & 17 deletions config/locales/bn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ bn:
A:
B:
Z:
sa_video_pay_bill:
A:
B:
Z:
sa_video_return_1:
A:
B:
Z:
sa_video_stop_self_employed:
A:
B:
Z:
call_for_evidence:
and:
another_website_html:
Expand Down Expand Up @@ -373,7 +385,6 @@ bn:
neighbourhood_watch:
open_consultations:
page_heading:
page_title:
petition_paragraph:
body_html:
create_a_petition:
Expand Down Expand Up @@ -527,31 +538,15 @@ bn:
proposed_date: প্রস্তাবিত প্রকাশ
reason_for_change: পরিবর্তন করার কারণ
release_date: প্রকাশের তারিখ
time:
formats:
short_ordinal: "%e %B %Y"
travel_advice:
alert_status:
avoid_all_but_essential_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> দেশের কিছু অংশে শুধু প্রয়োজনীয় ভ্রমণ ছাড়া সকল ধরনের ভ্রমণের বিরুদ্ধে পরামর্শ দিয়েছে।
avoid_all_but_essential_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> সমগ্র দেশে শুধু প্রয়োজনীয় ভ্রমণ ছাড়া সকল ধরনের ভ্রমণের বিরুদ্ধে পরামর্শ দিয়েছে।
avoid_all_travel_to_parts_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> দেশের কিছু অংশে সকল ধরনের ভ্রমণের বিরুদ্ধে পরামর্শ দিয়েছে।
avoid_all_travel_to_whole_country_html: <abbr title="Foreign and Commonwealth Office">FCO</abbr> সমগ্র দেশে সকল ধরনের ভ্রমণের বিরুদ্ধে পরামর্শ দিয়েছে।
context: বিদেশ ভ্রমণ সম্পর্কিত পরামর্শ
pages:
still_current_at: এখানে এখনও চলমান
summary: সারসংক্ষেপ
updated: হালনাগাদ করা হয়েছে
working_group:
contact_details: যোগাযোগের বিস্তারিত তথ্য
policies: নীতিমালা
worldwide_organisation:
corporate_information:
about_our_services_html: "%{link} খুঁজুন।"
personal_information_charter_html: আমরা কিভাবে আপনার ব্যক্তিগত তথ্য নিয়ে কাজ করি তা আমাদের %{link}-এ ব্যাখ্যা করা হয়েছে।
publication_scheme_html: আমরা নিয়মিতভাবে যে প্রকারের সংবাদ প্রকাশ করি তা আমাদের %{link}-এ পড়ুন।
social_media_use_html: "%{link}-এ আমাদের নীতিমালা পড়ুন।"
welsh_language_scheme_html: "%{link}-এ আপনার আমাদের অঙ্গীকার সম্পর্কে জানুন।"
find_out_more: সম্পূর্ণ প্রোফাইল ও সকল কন্টাক্টের বিস্তারিত তথ্য দেখুন
headings:
contact_us: আমাদের সাথে যোগাযোগ
corporate_information: কর্পোরেট তথ্য
Expand Down
Loading

0 comments on commit edb190c

Please sign in to comment.