What is JavaScript?
JavaScript is a development language that powers 95% of all web pages on the internet. The standard page downloads an average of 20 JavaScript files per view.
The JavaScript is processed by a user's browser when they visit a page on your website. If the code contains mistakes, a JavaScript error will occur.
A Script error is the most common type of JavaScript error, you can read more here.
Errors are not always visible to users on your site's front-end, but when they are, users can encounter:
- Error messages
- Pages not loading at all
- Long load times
- Unresponsive CTAs
- Empty dropdown menu
How JavaScript (JS) errors are collected
Enabling JS error collection
Admin users on your project can enable or disable JS error collection anytime. Depending on your plan, this is either done in your Project settings or in the Contentsquare Console. Review and follow the relevant steps for your plan below.
Free and Growth plans:
You can enable/disable JS error collection in your Project Settings:
- Click your profile icon from the top right, followed by 'Project and users'.
- Select the 'Tracking' menu.
- Next to 'Collect JS errors' use the on/off toggle button to enable/disable their collection.
Enterprise plans and Pro plans (with the Experience Monitoring add-on):
Visit our article on configuring error and Network details collection.
Errors collected per pageview
A maximum of 20 JS errors are collected per pageview.
JS errors display format
JS errors are displayed in the following format: 'Error name: error message'.
Here are some examples:
Script error.
Uncaught TypeError: Cannot read property '0' of undefined
TypeError: this.stickyHeights is undefined
SecurityError: DOM exception 18: An attempt was made to break through
the security policy of the user agent
SyntaxError: expected expression, got end of script How to read JS errors in Error Analysis
Errors Analysis automatically tracks all JavaScript errors that users experienced during their visit.
By clicking on the error, you will see the error details opening on a side panel which allows you to differenciate the errors and identify their precise location.
- The first line displays the error type (in this case: a Javascript Error)
- The second line displays the Group Error ID.
- The third line is the file path.
- The fourth and fifth lines are the line and column in the file to help you located the error code.
You can also find JavaScript errors by searching them in the Error Explorer by clicking the
'Search' button under Search Errors.
In the error row displayed, you will see three lines of text for each JS Error; these are the error's (or grouped error's) details which allow you to differentiate the errors and identify their location:
- The first line displays the error type and the line and column int he file to help you locate the error code
- The second line displays the error name
- The third line is the location of the script file that contains the error of the URL if the JS code is in line within the HTML code.
Note: A .js extension (at the end of the script file) may not always been visible if the page is built using certain Single-page-application frameworks.
The JS error analysis module surfaces these glitches and prioritizes them relative to your unique website KPIs.