Skip to content

Commit

Permalink
PR Change: Add GA4 section to contacts render
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Feb 21, 2024
1 parent e6e0dd4 commit 06b92ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/views/organisations/_freedom_of_information.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
</section>
7 changes: 5 additions & 2 deletions spec/features/organisation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions spec/support/organisation_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down

0 comments on commit 06b92ed

Please sign in to comment.