Skip to content

Commit

Permalink
Search tracking for manual pages
Browse files Browse the repository at this point in the history
  • Loading branch information
andysellick committed Oct 3, 2023
1 parent 727ef33 commit 22ffe71
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/views/content_items/manuals/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<%= content_tag(:header, aria: { "labelledby": "manual-title" }, class: classes) do %>
<div class='govuk-grid-column-two-thirds'>

<% if type %>
<span class="manual-type"><%= type %></span>
<% end %>
Expand All @@ -22,7 +21,6 @@
margin_bottom: margin_bottom,
} %>


<%
# The metadata component on this page receives ga4_tracking: true as it has a 'See all updates' link.
metadata_with_ga4_tracking = { ga4_tracking: true }
Expand All @@ -31,15 +29,24 @@
<%= render 'govuk_publishing_components/components/metadata', metadata_with_ga4_tracking %>

<div class="in-manual-search">
<form action="/search/all" >

<%
form_data = {
module: "ga4-form-tracker",
ga4_form: {
event_name: "search",
type: "content",
section: content_item.title,
action: "search"
}
}
%>
<%= content_tag('form', action: "/search/all", data: form_data) do %>
<input type='hidden' name="manual[]" value="<%= content_item.base_path %>">

<%= render "govuk_publishing_components/components/search", {
on_govuk_blue: true,
label_text: t("manuals.search_this_manual"),
} %>
</form>
<% end %>
</div>
</div>
<% end %>
Expand Down

0 comments on commit 22ffe71

Please sign in to comment.