piwik-react-router
piwik-react-router copied to clipboard
react-router-dom
trafficstars
does it support react-router-dom@5+
Yes, I have this working
@jonfreedman Hey, could you give any example how to get this work with BrowserRouter?
See https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Router.md#router
You need to replace BrowserRouter with Router and call createBrowserHistory() e.g
const history = createBrowserHistory();
const matomo = PiwikReactRouter({
clientTrackerName: 'matomo.js',
serverTrackerName: 'matomo.php',
siteId: matomoSiteId,
url: matomoUrl
});
return (
<Router history={matomo.connectToHistory(history)}>
<YourApp />
</Router>
);
@jonfreedman Thanks a lot for your answer ! I managed to get the same solution, but thanks again for your response :)