Skip to content
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

Improvements to our RUM implimentation #2516

Closed
3 tasks done
Nooshu opened this issue Jun 16, 2021 · 7 comments
Closed
3 tasks done

Improvements to our RUM implimentation #2516

Nooshu opened this issue Jun 16, 2021 · 7 comments
Assignees

Comments

@Nooshu
Copy link
Contributor

Nooshu commented Jun 16, 2021

These apply to both static and govuk_publishing_components.

Make sure LUX data is captured when a user first accepts the cookie banner

Iniitial data is currently discarded and the beacon only fires on the 2nd page load. SpeedCurve have guidence on how to handle with cookie banners here.

Remove the CSP workarounds connect-src etc

SC support have stated that they will change the content type of the image early next week so they match, this workaround will then no longer be required.

Double check hard-coded sample rate is set to 1%

I believe we may have a 100% sample rate hard-coded somewhere. e.g. LUX.sampleRate(100). What is currently happening is the JS is sending 100% traffic to SC, the UI is set to 1% so 99% of the beacons are being rejected by the server.

Note on sample rates:

if we want 1% across all pages then it’s best to remove sampleRate() from the JS in our pages and set 1% in the UI settings. Or if we want different sample rates on different pages set targeted sample rates per page using sampleRate() and then use 100% in the settings.

For the moment we should remove the hard-coded sampleRate() and rely on the SC UI to set to 1%.

Todo List:

  • Make sure LUX data is captured when a user first accepts the cookie banner
  • Remove the CSP workarounds connect-src etc
  • Double check hard-coded sample rate is set to 1%
@injms
Copy link
Contributor

injms commented Jun 17, 2021

It looks as if LUX defaults to 100% if LUX.samplerate isn't set:

_samplerate = void 0 !== LUX.samplerate ? LUX.samplerate : 100;

This can be fixed by setting the samplerate variable inside the main LUX function - I'll raise a pull request to do that.

@injms
Copy link
Contributor

injms commented Jun 19, 2021

With the release of v24.15.0 of the components gem, the sampling rate for LUX has been now set to 1% instead of the default 100%.

As the gem verison of LUX is now being used by Static, the bump to v24.15.0 of the gem should fix the sampling rate issue across all of the frontend apps regardless of the template that is being used.

@injms
Copy link
Contributor

injms commented Jun 21, 2021

When running LUX.forceSample() locally the response has a content type of image/webp - I haven't been able to verify this on production as I'm not being sampled, but I think it'd be the same as the change is on SpeedCurve's server.

I've checked and the response now has an image content-type when on production as well - we should be able to remove connect-src from the content security policy safely now.

@injms
Copy link
Contributor

injms commented Nov 9, 2021

A user's first page visit is now measured after (and only after) they've consented to the appropriate cookies.

This was released in v24.18.1 of the components gem, which was then bumped in Static in #2539.

@injms
Copy link
Contributor

injms commented Nov 10, 2021

I've raised a pull request to remove the lux.speedcurve.com domain from the connect-src content security policy: alphagov/govuk_app_config#216

@injms
Copy link
Contributor

injms commented Feb 1, 2022

I've raised a pull request to remove the lux.speedcurve.com domain from the connect-src content security policy: alphagov/govuk_app_config#216

This pull request to sort out govuk_app_config has been merged in and released (alphagov/govuk_app_config#220) - this will be winging its way to all of the frontend applications over the next day or so thanks to dependabot.

@Nooshu
Copy link
Contributor Author

Nooshu commented Feb 15, 2022

Awesome work as always @injms! Closing issue as all fixed!

@Nooshu Nooshu closed this as completed Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants