diff --git a/app/views/organisations/_freedom_of_information.html.erb b/app/views/organisations/_freedom_of_information.html.erb index e50b6ea42..c216bbb63 100644 --- a/app/views/organisations/_freedom_of_information.html.erb +++ b/app/views/organisations/_freedom_of_information.html.erb @@ -30,7 +30,7 @@ <% end %> <% if @contacts.has_foi_contacts? %> - <%= render partial: 'contacts', locals: { contacts: @contacts.foi_contacts } %> + <%= render partial: 'contacts', locals: { contacts: @contacts.foi_contacts, ga4_section: t('organisations.foi.make_an_foi_request', lang: :en) } %> <% end %> <% end %> diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index 7fb99cae2..c91d15fbe 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -460,9 +460,12 @@ it "has GA4 tracking on email links" do visit "/government/organisations/prime-ministers-office-10-downing-street" - test_ga4_email_links + test_ga4_email_links("#org-contacts") visit "/government/organisations/attorney-generals-office" - test_ga4_email_links + test_ga4_email_links("#org-contacts") + + visit "/government/organisations/office-of-the-secretary-of-state-for-wales.cy" + test_ga4_email_links("#freedom-of-information") end end diff --git a/spec/support/organisation_helpers.rb b/spec/support/organisation_helpers.rb index 60dc63de3..5c6f8b1c5 100644 --- a/spec/support/organisation_helpers.rb +++ b/spec/support/organisation_helpers.rb @@ -927,9 +927,9 @@ def test_ga4_get_emails_link expect(ga4_link_data["section"]).to eq section_heading end - def test_ga4_email_links - section_heading = page.first("#org-contacts h2").text - links = page.all("#org-contacts p[data-ga4-link]") + def test_ga4_email_links(selector) + section_heading = page.first("#{selector} h2").text + links = page.all("#{selector} p[data-ga4-link]") links.each do |link| expect(link["data-module"]).to eq "ga4-link-tracker" expect(link["data-ga4-do-not-redact"]).to eq ""