faro-web-sdk icon indicating copy to clipboard operation
faro-web-sdk copied to clipboard

React Router integration. Add log of previous route.

Open CyberDoge opened this issue 2 years ago • 4 comments

Description

Current version of React Router logs only destination of route. It would be useful if previous route also was logged. Example of an event:

{
  "events": [
    {
      "name": "routeChange",
      "domain": "browser",
      "attributes": {
        "url": "http://localhost:3000/lk/personal",
        "route": "/lk/personal",
        "from": "/index"
      },
      "timestamp": "2023-01-16T09:02:53.416Z"
    }
  ]
}

CyberDoge avatar Jan 16 '23 09:01 CyberDoge

Hey @CyberDoge !

Before working on this, can you provide a little bit of context why this is needed?

The previous URL/route can be obtained by checking the previous routeChange event for the current session ID.

bfmatei avatar Jan 17 '23 11:01 bfmatei

Hello, i just wanted to log how a potential user would be redirected to 404 page

CyberDoge avatar Jan 17 '23 12:01 CyberDoge

@bfmatei has this been implemented already?

eskirk avatar Aug 14 '23 23:08 eskirk

@eskirk

Double checked. Is implemented for React Router V6 but not for V5

codecapitano avatar Feb 16 '24 11:02 codecapitano