Experience Monitoring has tools to capture API errors or unmanaged JS errors. E.g. Technical errors which were not expected to happen.
However there are many other errors (some expected) which can lead to messages being displayed to users. E.g. “Oops, This product is out of stock” or "This is not a valid zip code’.
Custom Errors enables you to collect and rank by business impact, any handled error message that happens during the user’s experience so you can better understand which fixes to prioritize first.
What are Custom Errors
Custom errors collect any text displayed on the user’s screen E.g. Text message in banners and pop ups or in a form field based on a user action.
Example of a form validation error:
You can also use Custom Errors to collect errors that are not visible to users.
Custom errors contain the following information:
Error Information | Details |
The Text message obtained | (E.g. Sorry your account could not be reactivated) |
The timestamp of the event | |
Optional Attributes | Information that helps specify the error (type, severity) |
How to collect Custom Errors
A maximum of 20 custom errors can be collected per pageview (this limit includes console messages).
Step One: Function Implementation
You need to implement a function directly in the code of the web page to be able to collect custom errors. The function should be triggered whenever the to-be-collected text is displayed on the screen.
Static Example: Collecting a specific text string (You will need to implement this function for each specific text string you want to collect).
window._uxa.push(["trackError","140000 is not a valid postcode"])
Dynamic Example: Collecting a generic string (You can use this option so you don't have to set up a different snippet for every single error string).
window._uxa.push([ "trackError", document.querySelector("div[class='newMessagesInfo newError']").textContent, ])
The Tracking Tag will use the trackError
command and route the data to the /custom-errors endpoint.
You can use the trackError
command with attributes and we recommend specifying attributes so the error can be categorized.
Example of a trackError
command with attributes:
window._uxa.push(["trackError", "140000 is not a valid postal code",
{type: "formValidation", severity:"minor", language: "english"}])
Step two: Set up optional attributes
The attribute is a javascript object in the form 'key':'value'.
Note: The 'Key' is only to be used for categorization, and 'Value' is the exact category name.
Below is an example of an attributes object:
{type: "formValidation", severity: "minor", language: "english"
}
Limitations of the attributes object include:
- The number of properties (aka number of attributes) is limited to 5
- Max key length: 30 characters
- Max value length: 30 characters
Examples of custom errors and naming best practices
Please find examples of potential custom errors and recommended naming conventions, for implementation of custom errors, per use case.
To be able to filter and prioritize custom errors easily, it is highly recommended that you use our guide to using attributes to specify the error message.
Note: The 'Key' is only to be used for categorization, and 'Value' is the exact category name.
Text string example | Errortype (highly recommended) | Additional optional attribute (actual name of values) |
Generic types and examples |
Key: formValidation formSubmitFail textInfo textError caughtError httpError timeout slowRequest Implementation example: {type: formValidation}
|
Key: critical high medium low ---------------------------------- Key: english french hebrew chinese ---------------------------------- Key: Suggested Values: 404 500 Failed to execute ReferenceError SyntaxError TypeError URIError EvalError InternalError |
FORM COMPLETION
Message string | Errortype (highly recommended) | Example of additional optional attribute (name of values) |
Form submit failure |
Key: type {type: formSubmitFail} |
Key: language Value: english {language: english} |
Please select an option |
Key: type {type: formValidation} |
Key: language {language: english} |
Invalid entry number |
Key: type {type: formValidation} |
Key: language {language: english} |
Missing a form field error |
Key: type {type: formValidation} |
Key: language {language: english} |
Timeout for form completion |
Key: type {type: timeout} |
Key: language {language: english} |
This field cannot be left blank |
Key: type {type: formValidation} |
Key: language {language: english} |
SEARCH RESULTS
Message string | Errortype (highly recommended) | Additional optional attribute (actual name of values) |
No search results error |
Key: type {type: textInfo} |
Key: language {language: english} |
No results found with a particular keyword search |
Key: type {type: textInfo} |
Key: language {language: english} |
PRODUCT PAGE (PDP)
Message string | Errortype (highly recommended) | Additional optional attribute (actual name of values) |
Product is no longer available |
Key: type {type: textInfo} |
Key: language {language: english} |
Choose a size |
Key: type {type: textInfo} |
Key: language Value: english {language: english} |
Item could not be added to cart |
Key: type {type: textError} |
Key: language Value: english {language: english} |
Exceeded number of items in cart |
Key: type {type: textInfo} |
Key: language Value: english {language: english} |
CHECKOUT
Message string | Errortype (highly recommended) | Additional optional attribute(s) (actual name of values) |
Payment failure |
Key: type {type: textError} |
Key: language {language: english},
{severity: critical} |
Confirm the security code for this card |
Key: type {type: textInfo} |
Key: language {language: english} |
Item could not be added to cart |
Key: type {type: textError} |
Key: language {language: english} |
Exceeded number of items in cart |
Key: type {type: textInfo} |
Key: language {language: english} |
Promo code did not work |
Key: type {type: textInfo} |
Key: language {language: english} |
Incorrect format for postcode/phone number |
Key: type {type: textInfo} |
Key: language {language: english} |
Voucher code error |
Key: type {type: textError} |
Key: language {language: english} |
This configuration is no longer available for this date range |
Key: type {type: textInfo} |
Key: language {language: english} |
Transfer could not be completed at this time |
Key: type {type: textError} |
Key: language {language: english} |
No items in cart |
Key: type {type: textInfo} |
Key: language {language: english} |
LOGIN
Message string | Errortype (highly recommended) | Additional optional attribute(s) (actual name of values) |
Password error |
Key: type {type: textInfo} |
Key: language {language: english} |
Login failure |
Key: type {type: textError} |
Key: language {language: english} |
Already have an account |
Key: type {type: textInfo} |
Key: language {language: english} |
Please confirm you aren't a bot |
Key: type {type: textInfo} |
Key: language {language: english} |
MISCELLANEOUS
INSERT PANEL TEXT
Message string | Errortype (highly recommended) | Additional optional attribute(s) (actual name of values) |
Looks like something went wrong |
Key: type {type: textError} |
Key: language {language: english} |
404 page/Dead end page*
*These kind of errors can be monitored both with a pageview (to be seen in Journey Analysis) and with a Custom Error (to see the impact in Error Analysis). |
Key: type {type: httpError} |
Key: language {language: english} ---------------------------------- Key: errorStatus {errorStatus: 404} |
Key information is missing from your file |
Key: type {type: textInfo} |
Key: language {language: english} |
Track Adblocking |
Key: type {type: caughtError} |
Key: language Value: english {language: english} |
Video is not available/not loaded |
Key: type {type: textError} |
Key: language Value: english {language: english} |
No store around this location |
Key: type {type: textInfo} |
Key: language Value: english {language: english} |
Any service relying on an underlying API/service that is not available |
Key: type {type: textError} |
Key: language Value: english {language: english} |
FAQs
1. Can custom errors be collected retrospectively?
No custom errors cannot be collected retrospectively.
2. Do I need to add attributes when setting up custom errors?
Attributes are optional but we strongly advise that you specify attributes so the error can be categorized.