analytics/assets/js/dashboard/router.js
Uku Taht 8d9667a949
Show utm_medium, utm_source, and utm_campaign in sources modal (#321)
* Show utm_medium, utm_source, and utm_campaign in sources modal

* Allow filtering by UTM tags

* Integrate filters with URL bar

* Add CHANGELOG entry

* Refresh modal when filter changes

* Remove Direct / None from campaign results

* Add UTM tabs to top sources report

* Add pagination

* Remove dropdown from top sources popup

* Fix bug in clickhouse_ecto

* Remove referrers_for_goal

* Make sure UTM tags work OK with goals

* Make source tab selection sticky

* Consistent styling for devices and source tabs

* Add noref in realtime to utm tabs

* Fix tests
2020-09-28 11:29:24 +03:00

50 lines
1.5 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 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/countries">
<CountriesModal site={site} />
</Route>
</Switch>
</Route>
</BrowserRouter>
);
}