Skip to content

Commit

Permalink
Add GA4 scroll tracking to guide pages
Browse files Browse the repository at this point in the history
- adds GA4 scroll tracking to 110 specific guide pages
  • Loading branch information
andysellick committed Nov 30, 2023
1 parent c013bfd commit f7d6a41
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,129 @@
"/apply-to-come-to-the-uk",
]

ga4_scroll_track_headings_paths = [
"/log-in-register-hmrc-online-services",
"/universal-credit",
"/pay-dartford-crossing-charge",
"/prove-right-to-work/get-a-share-code-online",
"/prove-right-to-work",
"/renew-adult-passport/renew",
"/change-address-driving-licence",
"/self-assessment-tax-returns",
"/vehicle-log-book",
"/income-tax-rates",
"/the-warm-home-discount-scheme",
"/winter-fuel-payment",
"/pay-self-assessment-tax-bill",
"/log-in-register-hmrc-online-services/register",
"/pip/how-much-youll-get",
"/help-with-childcare-costs",
"/pip/eligibility",
"/pension-credit",
"/child-maintenance-service",
"/child-benefit/how-to-claim",
"/carers-allowance",
"/photos-for-passports",
"/budgeting-help-benefits/how-to-apply",
"/update-uk-visas-immigration-account-details",
"/renew-adult-passport",
"/new-state-pension/what-youll-get",
"/get-a-passport-urgently",
"/power-of-attorney",
"/child-trust-funds/find-a-child-trust-fund",
"/student-finance",
"/apply-national-insurance-number/how-to-apply",
"/inheritance-tax",
"/child-benefit-tax-charge",
"/power-of-attorney/make-lasting-power",
"/prove-right-to-rent",
"/attendance-allowance/how-to-claim",
"/prove-right-to-rent/get-a-share-code-online",
"/new-state-pension",
"/self-assessment-tax-returns/sending-return",
"/limited-company-formation/register-your-company",
"/electoral-register",
"/biometric-residence-permits",
"/winter-fuel-payment/how-to-claim",
"/self-assessment-tax-returns/who-must-send-a-tax-return",
"/apply-national-insurance-number",
"/get-a-passport-urgently/1-week-fast-track-service",
"/life-in-the-uk-test",
"/jobseekers-allowance",
"/the-warm-home-discount-scheme/low-income-England-Wales",
"/cold-weather-payment",
"/pay-corporation-tax",
"/repaying-your-student-loan",
"/carers-allowance/how-to-claim",
"/attendance-allowance/eligibility",
"/national-insurance",
"/applying-for-probate",
"/contact-pension-service",
"/employment-support-allowance/eligibility",
"/holiday-entitlement-rights",
"/get-a-child-passport",
"/paye-online",
"/national-insurance/your-national-insurance-number",
"/get-a-passport-urgently/online-premium-service",
"/log-in-register-hmrc-online-services/problems-signing-in",
"/pay-vat",
"/jobseekers-allowance/eligibility",
"/tax-overpayments-and-underpayments/if-youre-due-a-refund",
"/help-with-childcare-costs/free-childcare-2-year-olds",
"/applying-for-probate/apply-for-probate",
"/pension-credit/how-to-claim",
"/report-changes-child-benefit",
"/tax-codes/how-to-update-your-tax-code",
"/get-help-savings-low-income",
"/disability-living-allowance-children",
"/jobseekers-allowance/apply-new-style-jsa",
"/change-name-deed-poll",
"/statutory-sick-pay/what-youll-get",
"/get-information-about-property-and-land/copies-of-deeds",
"/schools-admissions/how-to-apply",
"/financial-help-disabled",
"/redundancy-your-rights/redundancy-pay",
"/tax-overpayments-and-underpayments",
"/tax-codes/emergency-tax-codes",
"/access-to-work",
"/skilled-worker-visa/apply-from-outside-the-uk",
"/disability-living-allowance-children/how-to-claim",
"/statutory-sick-pay/eligibility",
"/health-conditions-and-driving",
"/tax-relief-for-employees/working-at-home",
"/vehicle-log-book/if-you-cannot-apply-online",
"/what-different-qualification-levels-mean/list-of-qualification-levels",
"/tb-test-visa",
"/apply-to-come-to-the-uk/prepare-your-application",
"/apply-citizenship-indefinite-leave-to-remain/how-to-apply",
"/child-car-seats-the-rules",
"/pip/change-of-circumstances",
"/child-benefit-tax-charge/pay-the-charge",
"/uk-visa-sponsorship-employers",
"/personalised-vehicle-registration-numbers",
"/renew-adult-passport/replace",
"/apply-boiler-upgrade-scheme/check-if-youre-eligible",
"/council-housing",
"/carers-allowance/effect-on-other-benefits",
"/income-tax",
"/voluntary-national-insurance-contributions",
"/inheritance-tax/passing-on-home",
"/repaying-your-student-loan/which-repayment-plan-you-are-on",
"/changing-passport-information",
"/change-circumstances-visa-brp",
]

full_url = [@content_item.base_path, @content_item.part_slug].compact.join('/')
%>
<% if scroll_track_headings_paths.include?(full_url) %>
<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?(full_url) %>
<meta name="govuk:scroll-tracker" content="" data-module="ga4-scroll-tracker"/>
<% end %>
<% end %>

<% unless @content_item.requesting_a_part? %>
Expand Down

0 comments on commit f7d6a41

Please sign in to comment.