2019-11-20 08:48:27 +03:00
|
|
|
import React, { useEffect } from 'react';
|
2019-11-19 07:30:42 +03:00
|
|
|
import Dash from './index'
|
2020-09-28 11:29:24 +03:00
|
|
|
import SourcesModal from './stats/modals/sources'
|
2019-11-19 07:30:42 +03:00
|
|
|
import ReferrersDrilldownModal from './stats/modals/referrer-drilldown'
|
|
|
|
import GoogleKeywordsModal from './stats/modals/google-keywords'
|
|
|
|
import PagesModal from './stats/modals/pages'
|
Adds entry and exit pages to Top Pages module (#712)
* 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
2021-02-26 12:02:37 +03:00
|
|
|
import EntryPagesModal from './stats/modals/entry-pages'
|
|
|
|
import ExitPagesModal from './stats/modals/exit-pages'
|
2019-11-19 07:30:42 +03:00
|
|
|
import CountriesModal from './stats/modals/countries'
|
2021-06-21 14:42:16 +03:00
|
|
|
import FilterModal from './stats/modals/filter'
|
2019-11-19 07:30:42 +03:00
|
|
|
|
2019-11-20 08:48:27 +03:00
|
|
|
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;
|
|
|
|
}
|
2019-11-19 07:30:42 +03:00
|
|
|
|
2021-06-16 15:00:07 +03:00
|
|
|
export default function Router({site, loggedIn, currentUserRole}) {
|
2019-11-19 07:30:42 +03:00
|
|
|
return (
|
|
|
|
<BrowserRouter>
|
|
|
|
<Route path="/:domain">
|
2019-11-20 08:48:27 +03:00
|
|
|
<ScrollToTop />
|
2021-06-16 15:00:07 +03:00
|
|
|
<Dash site={site} loggedIn={loggedIn} currentUserRole={currentUserRole} />
|
2019-11-19 07:30:42 +03:00
|
|
|
<Switch>
|
2020-09-28 11:29:24 +03:00
|
|
|
<Route exact path={["/:domain/sources", "/:domain/utm_mediums", "/:domain/utm_sources", "/:domain/utm_campaigns"]}>
|
|
|
|
<SourcesModal site={site} />
|
2019-11-19 07:30:42 +03:00
|
|
|
</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>
|
Adds entry and exit pages to Top Pages module (#712)
* 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
2021-02-26 12:02:37 +03:00
|
|
|
<Route path="/:domain/entry-pages">
|
|
|
|
<EntryPagesModal site={site} />
|
|
|
|
</Route>
|
|
|
|
<Route path="/:domain/exit-pages">
|
|
|
|
<ExitPagesModal site={site} />
|
|
|
|
</Route>
|
2019-11-19 07:30:42 +03:00
|
|
|
<Route path="/:domain/countries">
|
|
|
|
<CountriesModal site={site} />
|
|
|
|
</Route>
|
2021-07-21 16:50:26 +03:00
|
|
|
<Route path={["/:domain/filter/:field"]}>
|
2021-06-21 14:42:16 +03:00
|
|
|
<FilterModal site={site} />
|
|
|
|
</Route>
|
2019-11-19 07:30:42 +03:00
|
|
|
</Switch>
|
|
|
|
</Route>
|
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
}
|