-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add real user metrics using Speedcurve's LUX #2135
Conversation
- Add test to ensure both scripts are present in the public layout component only when a user has allowed usage tracking cookies - Adds `lux` and `lux-polyfill` to the assets precompile list - Updates the LUX script to ensure that the image beacon is used - Updates the LUX script to add GDS's Speedcurve user ID number - usually this is appended to the script `src` with a query string, but that doesn't work in this instance as Rails adds a fingerprint to the filename that prevents the script from finding itself - Prettifies `lux-polyfill` to make it slightly easier to see what's going on; this is compressed when going through the asset pipeline - Add documentation explaining RUM and how to update the LUX scripts
44fbf33
to
51fd6a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few questions and thoughts.
app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js
Show resolved
Hide resolved
// Setting debug to `true` shows what happening as it happens. Running | ||
// `LUX.getDebug()` in the browser's console will show the history of what's | ||
// happened. | ||
LUX.debug = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds quite a lot of JS. Do we know exactly what the file size impact of this change will be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the file sizes are:
File | rum-loader |
lux-polyfill |
lux |
---|---|---|---|
Uncompressed | 1.5kb | 3.5kb | 33.5kb |
Minified | 1.1kb | 2.3kb | 21.8kb |
Minified and compressed | 0.4kb | 0.7kb | 6.6kb |
So the total sent over the wire is 7.8kb.
All of which is loaded using the async
attribute - so it won't block any loading or rendering of the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good numbers, and good to see you've got the stats. Worth adding to the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
What
Adds the real user metrics to the public layout component by adding the LUX scripts. This includes:
lux
andlux-polyfill
to the assets precompile listsrc
with a query string, but that doesn't work in this instance as Rails adds a fingerprint to the filename that prevents the script from finding itselflux-polyfill
to make it slightly easier to see what's going on; this is compressed when going through the asset pipelineWhy
Real user metrics will give a much greater insight into the performance of GOV.UK for everyone. This will show in greater detail what parts of GOV.UK can be improved without using synthetic tests and what steps can be taken to improve the experience for everyone.
This is a sibling pull request to alphagov/static#2445 - that covers the
core_layout
template; this pull request ensures that thegem_layout
in static has feature parity.Visual Changes
None.