Sending custom errors

With the Custom Errors feature, collect any text displayed on the user screen as a result of a specific action such as:

  • Filling a form,
  • Loading a product list,
  • Log in to a website,
  • A request failing to get the remaining stock quantity on a product page.

Custom errors can be located inside alert banners, pop-up windows, or inline in a form.

To collect custom error messages, use the trackError command:

<script type="text/javascript">
window._uxa = window._uxa || [];
window._uxa.push([
"trackError",
"<MESSAGE>",
{key: value, key: value, ...}
])
</script>

where:

  • <MESSAGE> is a string which contains the text displayed to end-users (max. 300 characters).
  • (optional) - A JavaScript object with up to 5 key/value pairs to categorize the errors. Both the key and value can be up to 30 characters.

Send a custom error for a failing request, typed as an error from the system:

<script type="text/javascript">
window._uxa = window._uxa || [];
window._uxa.push([
"trackError",
"Could not get stock quantity",
{"type": "systemError"}
])
</script>

Send a custom error for incorrect user input with multiple attributes (type, severity, language):

<script type="text/javascript">
window._uxa = window._uxa || [];
window._uxa.push([
"trackError",
"140000 is not a valid postal code",
{
"type": "formValidation",
"severity": "minor",
"lang": "english"
}
])
</script>

Verifying the sending of custom errors

Section titled Verifying the sending of custom errors

Use the Contentsquare Tracking Setup Assistant Chrome Extension to track custom errors that are sent.