From b663492a7a6b99775fba89b175e78048068b4e35 Mon Sep 17 00:00:00 2001 From: owenatgov Date: Mon, 9 Aug 2021 18:08:24 +0100 Subject: [PATCH] Add tracking for departments link on super nav header --- CHANGELOG.md | 4 ++++ .../_layout_super_navigation_header.html.erb | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b4464630..e8ba6a5fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ useful summary for people upgrading their application, not a replication of the commit log. +# Unreleased + +* Fix final issues with tracking on super nav header ([PR #2256](https://github.com/alphagov/govuk_publishing_components/pull/2256)) + # 25.2.2 * Fix typo in tracking module on super navigation header ([PR #2253](https://github.com/alphagov/govuk_publishing_components/pull/2253)) diff --git a/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb b/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb index cd57a89fe2..115af61d59 100644 --- a/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +++ b/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb @@ -90,9 +90,17 @@ show_navigation_menu_text = t("components.layout_super_navigation_header.menu_to tracking_label = link[:label].downcase.gsub(/\s+/, "") %> <%= tag.li class: li_classes do %> - - <%= link[:label] %> - + <%= link_to link[:label], link[:href], { + class: "gem-c-layout-super-navigation-header__navigation-item-link", + data: { + module: "gem-track-click", + track_action: "#{tracking_label}Link", + track_category: "headerClicked", + track_label: link[:href], + track_dimension: link[:label], + track_dimension_index: "29", + } + } %> <% if has_children %>