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

Fix error in LUX script #3592

Merged
merged 1 commit into from Sep 6, 2023
Merged

Fix error in LUX script #3592

merged 1 commit into from Sep 6, 2023

Conversation

andysellick
Copy link
Contributor

What

Fix an error in the live real user monitoring script relating to the unusual way in which we use this script.

  • to reproduce, clear cookies, reload page then accept cookies, error of Uncaught TypeError: Cannot read properties of null (reading 'pop') will occur
  • this refers to the getCustomerId() function, which if LUX.customerid is not defined will attempt to determine it from the source URL of the LUX script, something like lux.js?id=1234
  • we don't get our customerid this way, instead we hard code it into this file, because we host our own copy of the LUX script (see the documentation for more detail and background on this), so the script failed, because there was nothing to find
  • instead we remove this part of the getCustomerId() function and simply return LUX.customerid. We also now need to set this inside the LUX object itself, because otherwise it isn't set properly in the steps described above
  • documentation updated to reflect this for future updates

Why

Was causing an error on the live site. This is bad.

Visual Changes

None.

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3592 September 6, 2023 14:15 Inactive
- to reproduce, clear cookies, reload page then accept cookies, error of `Uncaught TypeError: Cannot read properties of null (reading 'pop')` will occur
- this refers to the `getCustomerId()` function, which if `LUX.customerid` is not defined will attempt to determine it from the source URL of the LUX script, something like `lux.js?id=1234`
- we don't get our customerid this way, instead we hard code it into this file, because we host our own copy of the LUX script (see the documentation for more detail and background on this), so the script failed, because there was nothing to find
- instead we remove this part of the `getCustomerId()` function and simply return `LUX.customerid`. We also now need to set this inside the LUX object itself, because otherwise it isn't set properly in the steps described above
- documentation updated to reflect this for future updates
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3592 September 6, 2023 14:18 Inactive
Copy link
Contributor

@AshGDS AshGDS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my local static 👍

@andysellick andysellick merged commit 6658836 into main Sep 6, 2023
7 checks passed
@andysellick andysellick deleted the fix-lux branch September 6, 2023 14:22
@andysellick andysellick mentioned this pull request Sep 6, 2023
andysellick added a commit that referenced this pull request Oct 19, 2023
- some things changed recently, including #3592
andysellick added a commit that referenced this pull request Oct 19, 2023
- some things changed recently, including #3592
andysellick added a commit that referenced this pull request Oct 19, 2023
- some things changed recently, including #3592
andysellick added a commit that referenced this pull request Oct 19, 2023
- some things changed recently, including #3592
andysellick added a commit that referenced this pull request Oct 19, 2023
- some things changed recently, including #3592
andysellick added a commit that referenced this pull request Oct 20, 2023
- some things changed recently, including #3592
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

Successfully merging this pull request may close these issues.

None yet

3 participants