diff --git a/app/views/shared/_webchat.html.erb b/app/views/shared/_webchat.html.erb index 01673eb28..4c86cfdfc 100644 --- a/app/views/shared/_webchat.html.erb +++ b/app/views/shared/_webchat.html.erb @@ -20,7 +20,15 @@ <%= t("shared.webchat.available") %> - <%= t("shared.webchat.speak_to_adviser") %>. + "> + <%= t("shared.webchat.speak_to_adviser") %> + . <% end %> diff --git a/test/integration/contact_test.rb b/test/integration/contact_test.rb index 80c35364c..7ba14d7aa 100644 --- a/test/integration/contact_test.rb +++ b/test/integration/contact_test.rb @@ -81,4 +81,11 @@ class ContactTest < ActionDispatch::IntegrationTest # reset back to default driver Capybara.use_default_driver end + + test "has GA4 tracking on the webchat available link" do + setup_and_visit_content_item("contact", { base_path: "/government/organisations/hm-passport-office/contact/hm-passport-office-webchat", details: { "more_info_webchat": "
Some HTML
\n" } }) + + assert_selector ".js-webchat-advisers-available a[data-module=ga4-link-tracker]" + assert_selector ".js-webchat-advisers-available a[data-ga4-link='{\"event_name\":\"navigation\",\"type\":\"webchat\",\"text\":\"Speak to an adviser now\"}']" + end end