Skip to content

Commit

Permalink
Amend the tracking category on Brexit child taxon pages
Browse files Browse the repository at this point in the history
  • Loading branch information
hannako committed Jul 15, 2021
1 parent fa5ff2b commit 3c15f14
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions app/presenters/content_item/brexit_taxons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/content_items/detailed_guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}) %>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/detailed_guide_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c15f14

Please sign in to comment.