Solved

Possible to track web errors like 400, 401, 403... ?

  • 10 May 2023
  • 1 reply
  • 308 views

Userlevel 2
Badge

Hi all,

 

I’m attempting to answer the following question in Heap: 

How much traffic goes to our various error pages?

  1. 400 Bad request
  2. 401 Unauthorized
  3. 403 Forbidden
  4. 404 Page not found
  5. 5xx Server error

 

Is this possible to answer with Heap? To answer this, would it require that we have specific pages for each error? Is this more of an engineering question?

 

Thanks in advance for your wisdom fellow Heapsters.

icon

Best answer by dlad 19 May 2023, 22:31

View original

1 reply

Userlevel 4
Badge +2

Hi Chase,

Thanks for your post, great question. I think you are on the right trail: it depends on the nature of the error page and how it’s displayed. If the error is displayed on pages you control, you can simply load Heap for those pages if there is enough specificity to tell which error it is e.g. www.yoursite.com/404 or something like that.

Otherwise, your engineers should bundle a heap.track() custom event as part of the error handling code. This may be as simple as a one-liner e.g.

try {

  your site’s code

} catch(er){

  your site’s error handling code

  heap.track(er.name, er.properties);

}

They may find this short developer documentation useful! https://developers.heap.io/docs/tracking-field-validation-errors

I hope this helps.

Reply