Skip to content

Commit

Permalink
Add tracking to the travel advice pages
Browse files Browse the repository at this point in the history
- uses the new feature of the track click script to track link clicks only inside the grey callout box (the second callout box on the page)
- this is inside govspeak content so we can't directly apply tracking to it, hence the new feature of the track click script to limit tracking to a specific element
  • Loading branch information
andysellick committed Sep 2, 2021
1 parent ea3621b commit 3130a17
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/views/content_items/travel_advice.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@
<%= render 'shared/travel_advice_summary', content_item: @content_item %>
<% end %>

<%= render 'govuk_publishing_components/components/govspeak', {
direction: page_text_direction,
} do %>
<%= raw(@content_item.current_part_body) %>
<% end %>
<div data-module="gem-track-click"
data-track-category="SummaryTravelAdviceWarning"
data-track-action="callOutBoxClicked"
data-track-links-only
data-limit-to-element-class="call-to-action">
<%= render 'govuk_publishing_components/components/govspeak', {
direction: page_text_direction,
} do %>
<%= raw(@content_item.current_part_body) %>

This comment has been minimized.

Copy link
@leenagupte

leenagupte Sep 2, 2021

Contributor

I think current_part_body is everything below the summary on the page, not just the callout box.
See:

So for example, on the "France" page for Safety and Security, everything below the Safety and Security heading will be tracked, because that's the "current part" on that page.
Screenshot 2021-09-02 at 16 49 08

Is that what was intended?

<% end %>
</div>

<%= render 'govuk_publishing_components/components/previous_and_next_navigation', @content_item.previous_and_next_navigation %>

Expand Down

0 comments on commit 3130a17

Please sign in to comment.