Creating events on APIs response
New
How to create event that track the success response of the APIs?
The user performed an action say clicked a button, which is associated to an API call, then how can I track whether the response of the API was success or failure?
0
Comments
1 comment
Hey@himanshu_v_verma! Thanks for reaching out! 😊
One option you could try is setting up an event listener on your page to send network requests that errored in as a custom event. You could try adding the below code immediately at the end of your FullStory snippet, but before the closing
</script>tag (I would not recommend setting this up to track every single successful call, as there could potentially be a lot of custom events that would be especially noisy in your sessions):I’d also like to mention that network errors (anything in the 4xx-5xx range) are already captured as an event in FS and indexed for search, so the example code above would/could lead to a duplicate (see screenshot) depending on what status code range you configured.
Please let me know if you have any other questions as I’d be happy to help!
Please sign in to leave a comment.