As I develop a single-page application that integrates a third-party analytics tool (such as Heap, Segment, Mixpanel, etc.), I am looking to actively monitor the outgoing HTTPS requests from my app and take necessary actions, such as logging.
I am curious if there is a browser-agnostic and protocol-agnostic method of achieving this. Perhaps a JavaScript library could provide a solution. So far, my research has led me to options like creating handlers for different types of requests. For instance, I could utilize this for XHR requests and this for fetch requests.
Thank you in advance.