joernroeder / piwik-react-router

Piwik analytics component for react-router
https://www.npmjs.org/package/piwik-react-router
MIT License
61 stars 22 forks source link

tracking not working #64

Open ranran2121 opened 1 year ago

ranran2121 commented 1 year ago

Hi, I have question about this package. I am using react router 4 so I have used the createBrowserhistory to create the history. This is the App.js file

import React from "react";
import { BrowserRouter } from "react-router-dom";
import { createBrowserHistory } from "history";
import Root from "./Root";
import config from "./config";
const PiwikReactRouter = require("piwik-react-router");

const matomoSiteId = config.matomoSiteId ? config.matomoSiteId : 3;
const matomoUrl = config.matomoUrl ? config.matomoUrl : "";

function App() {
  const piwik = PiwikReactRouter({
    url: matomoUrl,
    siteId: matomoSiteId,
  });
  const history = createBrowserHistory();

  return (
    <BrowserRouter history={piwik.connectToHistory(history)}>
      <Root />
    </BrowserRouter>
  );
}

export default App;

And in the index.html I am using the Matomo Tag manager and in my Matomo board I have configured a Matomo Analytics tag to track the navigation in my React web App

However we I click on the links in the navigation bar, the page URL is not tracked. Is there anything else I should do?