From 7e5a90ccb7a748ec80281da2ef9b29827bd4949a Mon Sep 17 00:00:00 2001 From: kr8n3r Date: Fri, 1 Nov 2019 15:23:58 +0000 Subject: [PATCH] Custom meta tag to track spelling suggestions For finders where we show spelling suggestions, we want to track their page view impressions. First part of the work is in static https://github.com/alphagov/static/pull/1927 Here we insert the meta tag into the document head for analytics script to pick up. --- app/views/finders/_spelling_suggestion.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/finders/_spelling_suggestion.html.erb b/app/views/finders/_spelling_suggestion.html.erb index c98551f60..506d21d5e 100644 --- a/app/views/finders/_spelling_suggestion.html.erb +++ b/app/views/finders/_spelling_suggestion.html.erb @@ -1,3 +1,5 @@ +<% # we want an empty string if there are no suggestions on page load %> +<% _spelling_suggestion = '' %> <% if @spelling_suggestion_presenter.suggestions.any? %>

Did you mean <% @spelling_suggestion_presenter.suggestions.each do |suggestion| %> @@ -5,6 +7,10 @@ class: "govuk-link govuk-!-font-weight-bold", :data => suggestion[:data_attributes] %> + <% _spelling_suggestion = suggestion[:keywords] %> <% end %>

-<% end %> \ No newline at end of file +<% end %> +<% content_for :head do %> + +<% end %>