2019-11-19 07:30:42 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
|
|
|
|
import Datepicker from './datepicker'
|
2019-11-20 08:48:27 +03:00
|
|
|
import Filters from './filters'
|
2019-11-19 07:30:42 +03:00
|
|
|
import CurrentVisitors from './stats/current-visitors'
|
|
|
|
import VisitorGraph from './stats/visitor-graph'
|
|
|
|
import Referrers from './stats/referrers'
|
|
|
|
import Pages from './stats/pages'
|
|
|
|
import Countries from './stats/countries'
|
2020-02-10 16:17:00 +03:00
|
|
|
import Devices from './stats/devices'
|
2019-11-19 07:30:42 +03:00
|
|
|
import Conversions from './stats/conversions'
|
|
|
|
import {parseQuery} from './query'
|
|
|
|
|
|
|
|
class Stats extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
this.state = {query: parseQuery(props.location.search, this.props.site)}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
if (prevProps.location.search !== this.props.location.search) {
|
|
|
|
this.setState({query: parseQuery(this.props.location.search, this.props.site)})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
renderConversions() {
|
|
|
|
if (this.props.site.hasGoals) {
|
|
|
|
return (
|
|
|
|
<div className="w-full block md:flex items-start justify-between mt-6">
|
|
|
|
<Conversions site={this.props.site} query={this.state.query} />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-10 16:17:00 +03:00
|
|
|
forgotten() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<OperatingSystems site={this.props.site} query={this.state.query} />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-11-19 07:30:42 +03:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="mb-12">
|
|
|
|
<div className="w-full sm:flex justify-between items-center">
|
|
|
|
<div className="w-full flex items-center">
|
2020-03-06 12:11:38 +03:00
|
|
|
<h2 className="text-left mr-8 font-semibold text-xl">Analytics for <a href={`//${this.props.site.domain}`} target="_blank">{this.props.site.domain}</a></h2>
|
2019-11-19 07:30:42 +03:00
|
|
|
<CurrentVisitors site={this.props.site} />
|
|
|
|
</div>
|
|
|
|
<Datepicker site={this.props.site} query={this.state.query} />
|
|
|
|
</div>
|
2019-11-20 08:48:27 +03:00
|
|
|
<Filters query={this.state.query} history={this.props.history} />
|
2019-11-19 07:30:42 +03:00
|
|
|
<VisitorGraph site={this.props.site} query={this.state.query} />
|
2020-02-10 16:17:00 +03:00
|
|
|
<div className="w-full block md:flex items-start justify-between">
|
2019-11-19 07:30:42 +03:00
|
|
|
<Referrers site={this.props.site} query={this.state.query} />
|
|
|
|
<Pages site={this.props.site} query={this.state.query} />
|
|
|
|
</div>
|
2020-02-10 16:17:00 +03:00
|
|
|
<div className="w-full block md:flex items-start justify-between">
|
|
|
|
<Countries site={this.props.site} query={this.state.query} />
|
|
|
|
<Devices site={this.props.site} query={this.state.query} />
|
2019-11-19 07:30:42 +03:00
|
|
|
</div>
|
|
|
|
{ this.renderConversions() }
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withRouter(Stats)
|