···5555 await next();
56565757 // REMINDER: only track the event if the request was successful
5858- if (!c.error) {
5858+ const isValid = c.res.status.toString().startsWith("2") && !c.error;
5959+6060+ if (isValid) {
5961 // We have checked the request to be valid already
6062 let json: unknown;
6163 if (c.req.raw.bodyUsed) {