Skip to content

Commit

Permalink
Merge pull request #3012 from alphagov/scroll-tracking-top-100
Browse files Browse the repository at this point in the history
Add scroll tracking to guides and answers
  • Loading branch information
andysellick authored Dec 12, 2023
2 parents 789f9d2 + 6baaec1 commit e26438e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/views/content_items/answer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,32 @@
scroll_track_percent_paths = [
"/get-coronavirus-test",
]
ga4_scroll_track_headings_paths = [
"/personal-tax-account",
"/log-in-file-self-assessment-tax-return",
"/benefits-calculators",
"/national-minimum-wage-rates",
"/order-coronavirus-rapid-lateral-flow-tests",
"/contact-hmrc",
"/dbs-update-service",
"/tax-free-childcare",
"/check-income-tax-current-year",
"/apply-apprenticeship",
"/report-covid19-result",
"/order-copy-birth-death-marriage-certificate",
"/global-health-insurance-card"
]
%>
<% if scroll_track_headings_paths.include?(@content_item.base_path) %>
<meta name="govuk:scroll-tracker" content="" data-module="auto-scroll-tracker" data-track-type="headings"/>
<% elsif scroll_track_percent_paths.include?(@content_item.base_path) %>
<meta name="govuk:scroll-tracker" content="" data-module="auto-scroll-tracker"/>
<% end %>

<% if ga4_scroll_track_headings_paths.include?(@content_item.base_path) %>
<meta name="govuk:scroll-tracker" content="" data-module="ga4-scroll-tracker"/>
<% end %>

<%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %>
<% end %>

Expand Down
8 changes: 8 additions & 0 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@
"/repaying-your-student-loan/which-repayment-plan-you-are-on",
"/changing-passport-information",
"/change-circumstances-visa-brp",
"/standard-visitor",
"/apply-to-come-to-the-uk",
"/change-address-v5c",
"/pip",
"/skilled-worker-visa",
"/child-benefit",
"/vehicle-tax-rate-tables",
"/tax-codes"
]

full_url = [@content_item.base_path, @content_item.part_slug].compact.join('/')
Expand Down

0 comments on commit e26438e

Please sign in to comment.