From 171fe91ce60ac6ff3d1cacae8839f5c2ebc60aa9 Mon Sep 17 00:00:00 2001 From: AshGDS <8880610+AshGDS@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:05:27 +0100 Subject: [PATCH] Add tool name to GA4 feedback component --- .../components/feedback/_problem_form.html.erb | 4 +++- .../components/feedback/_survey_signup_form.html.erb | 4 +++- .../components/feedback/_yes_no_banner.html.erb | 12 ++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb b/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb index 10a087e9b4..5431760719 100644 --- a/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +++ b/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb @@ -44,11 +44,13 @@ <% unless disable_ga4 + heading_text = t("components.feedback.help_us_improve_govuk", locale: :en) ga4_submit_button_event = { event_name: "form_submit", type: "feedback", text: t("components.feedback.send", locale: :en), - section: t("components.feedback.help_us_improve_govuk", locale: :en), + section: heading_text, + tool_name: heading_text }.to_json end %> diff --git a/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb b/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb index 8b30be6dde..68d5802e0a 100644 --- a/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +++ b/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb @@ -31,11 +31,13 @@ <% unless disable_ga4 + heading_text = t("components.feedback.help_us_improve_govuk", locale: :en) ga4_send_button_event = { event_name: "form_submit", type: "feedback", text: t("components.feedback.send_me_survey", locale: :en), - section: t("components.feedback.help_us_improve_govuk", locale: :en), + section: heading_text, + tool_name: heading_text }.to_json end %> diff --git a/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb b/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb index 10f7a5f95c..68354833b1 100644 --- a/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +++ b/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb @@ -1,24 +1,28 @@ <% unless disable_ga4 + heading_text = t("components.feedback.is_this_page_useful", locale: :en) ga4_yes_button_event = { "event_name": "form_submit", "type": "feedback", - "text": t("components.feedback.yes", locale: :en), - "section": t("components.feedback.is_this_page_useful", locale: :en), + "text": t("components.feedback.yes", locale: :en), + "section": heading_text, + "tool_name": heading_text, }.to_json ga4_no_button_event = { "event_name": "form_submit", "type": "feedback", "text": t("components.feedback.no", locale: :en), - "section": t("components.feedback.is_this_page_useful", locale: :en) + "section": heading_text, + "tool_name": heading_text, }.to_json ga4_problem_button_event = { "event_name": "form_submit", "type": "feedback", "text": t("components.feedback.something_wrong", locale: :en), - "section": t("components.feedback.is_this_page_useful", locale: :en) + "section": heading_text, + "tool_name": heading_text, }.to_json end %>