From 3c15f147eb44dcbc75b688087aaa26ef5f4a895a Mon Sep 17 00:00:00 2001 From: hannako Date: Thu, 15 Jul 2021 12:10:41 +0100 Subject: [PATCH] Amend the tracking category on Brexit child taxon pages --- app/presenters/content_item/brexit_taxons.rb | 11 ++++++++--- app/views/content_items/detailed_guide.html.erb | 2 +- .../detailed_guide/_brexit_sections.html.erb | 2 +- test/integration/detailed_guide_test.rb | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/presenters/content_item/brexit_taxons.rb b/app/presenters/content_item/brexit_taxons.rb index b140a8918..82ca215b0 100644 --- a/app/presenters/content_item/brexit_taxons.rb +++ b/app/presenters/content_item/brexit_taxons.rb @@ -13,17 +13,22 @@ def brexit_child_taxons text: I18n.t("brexit.citizen_link.text"), path: I18n.t("brexit.citizen_link.path"), track_label: "Guidance nav link", + track_category: "brexit-business-page", + }, + sections: { + track_category: "Child taxon section links - business", }, - track_category: "brexit-business-page", }, BREXIT_CITIZEN_PAGE_CONTENT_ID => { nav_link: { text: I18n.t("brexit.business_link.text"), path: I18n.t("brexit.business_link.path"), track_label: "Guidance nav link", - + track_category: "brexit-citizen-page", + }, + sections: { + track_category: "Child taxon section links - citizen", }, - track_category: "brexit-citizen-page", }, } end diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index 8193c07f6..ea394cd50 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -22,7 +22,7 @@ class: "govuk-link", data: { track_action: brexit_child_taxon[:nav_link][:path], - track_category: brexit_child_taxon[:track_category], + track_category: brexit_child_taxon[:nav_link][:track_category], track_label: brexit_child_taxon[:nav_link][:track_label], module: 'gem-track-click', }) %>. diff --git a/app/views/content_items/detailed_guide/_brexit_sections.html.erb b/app/views/content_items/detailed_guide/_brexit_sections.html.erb index 16c4265f2..576b25d33 100644 --- a/app/views/content_items/detailed_guide/_brexit_sections.html.erb +++ b/app/views/content_items/detailed_guide/_brexit_sections.html.erb @@ -12,7 +12,7 @@ <% links = section[:links].map do |link| link_to(link[:text], link[:path], class: "govuk-link", data: { track_action: link[:path], - track_category: "Child taxon section links", + track_category: brexit_child_taxon[:sections][:track_category], track_label: section[:title][:text] || "", module: 'gem-track-click', }) diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index 6ffae4166..ba8008b12 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -118,7 +118,7 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest track_label = find_link("Foreign travel advice")["data-track-label"] assert_equal "/foreign-travel-advice", track_action - assert_equal "Child taxon section links", track_category + assert_equal "Child taxon section links - citizen", track_category assert_equal "Travel to the EU", track_label # adds GA tracking to the description field links