mirror of
https://github.com/plausible/analytics.git
synced 2024-12-22 00:51:36 +03:00
ff32218bd0
* Initial Pass * Adds support for page visits counting by referrer * Includes goal selection in entry and exit computation * Adds goal-based entry and exit page stats, formatting, code cleanup * Changelog * Format * Exit rate, visit duration, updated tests * I keep forgetting to format :/ * Tests, last time * Fixes double counting, exit rate >100%, relevant tests * Fixes exit pages on filter and goal states * Adds entry and exit filters, fixes various bugs * Fixes discussed issues * Format * Fixes impossible case in tests Originally, there were only 2 pageviews for `test-site.com`,`/` on `2019-01-01`, but that doesn't make sense when there were 3 sessions that exited on the same site/date. * Format * Removes boolean function parameter in favor of separate function * Adds support for queries that use `page` filter as `entry-page` * Format * Makes loader/title interaction in sources report consistent
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
import React, { useEffect } from 'react';
|
|
import Dash from './index'
|
|
import SourcesModal from './stats/modals/sources'
|
|
import ReferrersDrilldownModal from './stats/modals/referrer-drilldown'
|
|
import GoogleKeywordsModal from './stats/modals/google-keywords'
|
|
import PagesModal from './stats/modals/pages'
|
|
import EntryPagesModal from './stats/modals/entry-pages'
|
|
import ExitPagesModal from './stats/modals/exit-pages'
|
|
import CountriesModal from './stats/modals/countries'
|
|
|
|
import {BrowserRouter, Switch, Route, useLocation} from "react-router-dom";
|
|
|
|
function ScrollToTop() {
|
|
const location = useLocation();
|
|
|
|
useEffect(() => {
|
|
if (location.state && location.state.scrollTop) {
|
|
window.scrollTo(0, 0);
|
|
}
|
|
}, [location]);
|
|
|
|
return null;
|
|
}
|
|
|
|
export default function Router({site, loggedIn}) {
|
|
return (
|
|
<BrowserRouter>
|
|
<Route path="/:domain">
|
|
<ScrollToTop />
|
|
<Dash site={site} loggedIn={loggedIn} />
|
|
<Switch>
|
|
<Route exact path={["/:domain/sources", "/:domain/utm_mediums", "/:domain/utm_sources", "/:domain/utm_campaigns"]}>
|
|
<SourcesModal site={site} />
|
|
</Route>
|
|
<Route exact path="/:domain/referrers/Google">
|
|
<GoogleKeywordsModal site={site} />
|
|
</Route>
|
|
<Route exact path="/:domain/referrers/:referrer">
|
|
<ReferrersDrilldownModal site={site} />
|
|
</Route>
|
|
<Route path="/:domain/pages">
|
|
<PagesModal site={site} />
|
|
</Route>
|
|
<Route path="/:domain/entry-pages">
|
|
<EntryPagesModal site={site} />
|
|
</Route>
|
|
<Route path="/:domain/exit-pages">
|
|
<ExitPagesModal site={site} />
|
|
</Route>
|
|
<Route path="/:domain/countries">
|
|
<CountriesModal site={site} />
|
|
</Route>
|
|
</Switch>
|
|
</Route>
|
|
</BrowserRouter>
|
|
);
|
|
}
|