Commit 66f7e3a6 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added basic matomo tracking.

parent 3eb08315
Pipeline #53437 passed with stages
in 21 minutes and 26 seconds
......@@ -41,24 +41,6 @@
</noscript>
<script src="%PUBLIC_URL%/env.js"></script>
<!-- Matomo -->
<script type="text/javascript">
if (!window.nomadEnv.debug) {
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//labdev-nomad.esc.rzg.mpg.de/fairdi/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
}
</script>
<!-- End Matomo Code -->
<div id="root"></div>
<!--
This HTML file is a template.
......
......@@ -444,24 +444,24 @@ export default class App extends React.Component {
return (
<MuiThemeProvider theme={genTheme}>
<ErrorSnacks>
<BrowserRouter basename={process.env.PUBLIC_URL}>
<ApiProvider>
<DomainProvider>
<Navigation>
<Switch>
{Object.keys(this.routes).map(route => (
{/* <BrowserRouter basename={process.env.PUBLIC_URL}> */}
<ApiProvider>
<DomainProvider>
<Navigation>
<Switch>
{Object.keys(this.routes).map(route => (
// eslint-disable-next-line react/jsx-key
<Route key={'nop'}
<Route key={'nop'}
// eslint-disable-next-line react/no-children-prop
children={props => this.renderChildren(route, props)}
exact={this.routes[route].exact}
path={this.routes[route].path} />
))}
</Switch>
</Navigation>
</DomainProvider>
</ApiProvider>
</BrowserRouter>
children={props => this.renderChildren(route, props)}
exact={this.routes[route].exact}
path={this.routes[route].path} />
))}
</Switch>
</Navigation>
</DomainProvider>
</ApiProvider>
{/* </BrowserRouter> */}
</ErrorSnacks>
<LicenseAgreement />
</MuiThemeProvider>
......
import { createBrowserHistory } from 'history'
export default createBrowserHistory()
......@@ -5,6 +5,20 @@ import ReactDOM from 'react-dom'
import './index.css'
import App from './components/App'
import registerServiceWorker from './registerServiceWorker'
import { Router } from 'react-router-dom'
import history from './history'
import PiwikReactRouter from 'piwik-react-router'
import { debug } from './config'
ReactDOM.render(<App />, document.getElementById('root'))
const matomo = PiwikReactRouter({
url: 'https://labdev-nomad.esc.rzg.mpg.de/fairdi/matomo/',
siteId: 1
})
console.log(debug)
ReactDOM.render(
<Router history={debug ? history : matomo.connectToHistory(history)}>
<App />
</Router>, document.getElementById('root'))
registerServiceWorker()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment