Skip to content

Commit

Permalink
Use new GA4 search tracker in layout super nav header
Browse files Browse the repository at this point in the history
  • Loading branch information
csutter committed Oct 31, 2024
1 parent cd910d3 commit 80728ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## Unreleased

* Chart component accessibility improvements ([PR #4344](https://github.com/alphagov/govuk_publishing_components/pull/4344))
* Add new custom analytics tracker for search ([PR #4354](https://github.com/alphagov/govuk_publishing_components/pull/4354)))
* Add new custom analytics tracker for search and use in layout super nav header ([PR #4354](https://github.com/alphagov/govuk_publishing_components/pull/4354))

## 44.9.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,12 @@
class: "gem-c-layout-super-navigation-header__search-form",
id: "search",
data: {
module: "ga4-form-tracker",
ga4_form: {
event_name: "search",
type: "header menu bar",
section: "Search GOV.UK",
action: "search",
url: "/search/all",
index_section: 3,
index_section_count: 3,
},
ga4_form_include_text: "",
ga4_form_no_answer_undefined: "",
module: "ga4-search-tracker",
ga4_search_type: "header menu bar",
ga4_search_url: "/search/all",
ga4_search_section: "Search GOV.UK",
ga4_search_index_section: 3,
ga4_search_index_section_count: 3,
},
action: absolute_links_helper.make_url_absolute("/search/all"),
method: "get",
Expand Down
11 changes: 1 addition & 10 deletions spec/components/layout_super_navigation_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,6 @@ def component_name
assert_select 'a[data-ga4-link=\'{"event_name":"navigation","type":"header menu bar","index_section":1,"index_link":16,"index_section_count":3,"index_total":16,"section":"Services and information"}\']'
assert_select 'a[data-ga4-link=\'{"event_name":"navigation","type":"header menu bar","index_section":2,"index_link":1,"index_section_count":3,"index_total":6,"section":"Government activity"}\']'
assert_select 'a[data-ga4-link=\'{"event_name":"navigation","type":"header menu bar","index_section":2,"index_link":6,"index_section_count":3,"index_total":6,"section":"Government activity"}\']'
form_attributes = {
event_name: "search",
type: "header menu bar",
section: "Search GOV.UK",
action: "search",
url: "/search/all",
index_section: 3,
index_section_count: 3,
}.to_json
assert_select "form[data-ga4-form=\'#{form_attributes}\']"
assert_select "form[data-module='ga4-search-tracker']"
end
end

0 comments on commit 80728ed

Please sign in to comment.