JavaScript Errors

When an uncaught error is thrown in JavaScript code, it is gathered up by the agent and linked to the appropriate user interaction.

Script Error

When an error happens in a script loaded from a third party domain, web browsers include additional protections for user data. While error details are visible in developer console (and similar tools), gathering it programmatically gets blocked and error message is set to “Script Error”. This is done to avoid leaking personal data on the user from other sites.

Third party scripts can be whitelisted from this behaviour by loading them in a way that passes CORS rules. This requires both server-side configuration and changes to including script tag:

1. Server must respond with the correct CORS header(s)

Examples:

Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: https://example.com

2. Adding crossorigin attribute to the script tag with appropriate value

Example with normal script tag:

<script src="https://example.org/script.js" crossorigin="anonymous"></script>

Example with a script tag that loads another script:

<script>
var s = document.createElement('s')
s.src = 'https://example.org/script.js'
s.setAttribute('crossorigin', 'anonymous')
document.getElementsByTagName('head')[0].appendChild(s)
</script>
Note: Browser agent installations before August 2018 may also be missing this attribute and can impact the amount of script errors (due to the agent wrapping some browser methods). Feel free to add that attribute to our agent code.

Scripts Failed To Load

When JavaScript error happens and current interaction or related page load interaction has related script assets which failed to load, then error name is “Scripts failed to load”.

Example:

Stacktrace: TypeError:$(...).tabs is not a function... 
Related scripts that failed to load: https://example.com/example.js

Warnings By Default

As JavaScript is ran in the user’s browser, some errors caused by the environment may also be picked up by us, for example if the user has a broken extension. We use files referenced in the stack trace (for example if the majority of lines are pointing to non-http resources, such as safari-extension://, or are completely anonymous) to guess if the error is more likely caused by these factors outside your application. Such errors get instantly demoted to warnings and can be checked separately in the warnings list.