Before you start
You need:
- Enable Custom errors from Configure Error collection before you create a snippet in the Console.
- A user-facing or business-specific message that you want to collect.
- A clear definition of when Contentsquare should send the Custom Error.
When to use Custom errors
Use a Custom error when a user action produces a meaningful problem that is not necessarily a standard JavaScript or API error.
Examples include:
- A form-validation message.
- An unavailable product warning.
- A failed login or request.
- A product list that cannot load.
- A message displayed in an alert, pop-up, or inline form element.
Keep the message useful for investigation and free of personal data.
Create a Custom Error snippet
- In the Error collection settings page, find the Custom errors card.
- Click Configure.
- Enter a Snippet name.
- Select the Custom error template.
- Enter the Error message to collect.
- Add Attributes when you need to categorize the error.
- Add a Trigger that determines when the snippet runs.
- Click Save.
The exact trigger options depend on the template and the project configuration. In the example shown in the Console, a Custom error can be triggered when an element becomes visible.
Choose useful messages and attributes
Use a stable message that describes the problem rather than copying user-entered text. Use attributes to add stable context, such as the error source or severity.
The current web technical documentation supports:
- Up to 20 Custom Errors per page.
- An error message of up to 300 characters.
- Up to 5 Custom Attributes.
- Attribute keys and values of up to 30 characters.
Do not use attributes for personal data, session identifiers, email addresses, or free-form user input.
Send Custom Errors from your implementation
You can also send Custom Errors directly from your website implementation by using the dedicated Contentsquare command. Use the Error Analysis Technical Documentation for the implementation syntax and examples.
Use the Console snippet when a visual trigger is the simplest way to identify the message. Use the implementation command when your application logic already knows when the error occurs.
Troubleshoot missing Custom errors
If the Custom Error does not appear:
- Check that the Custom errors setting is collecting.
- Check that the snippet trigger matches the page element or action.
- Check that the snippet is saved and active.
- Check that the message stays within the supported length.
- Check that you are viewing the same project and data source where the error occurred.
- Wait for the expected processing delay before testing again.
Related articles
- Configure Errors data collection
- Error Analysis — Web (technical documentation)