I find it hard to believe the devs behind Gov.uk were genuinely considering hard coding all URLs and headings in to FE JS. Surely their mind went to the “window.location” + throttle scroll function solution/“better but not suitable Intersection Observer” options first?
Glad they settled on those either way, because adding 200kb of uncompressed URLs and heading text for tracking is madness.