mirror of
https://github.com/plausible/analytics.git
synced 2025-01-03 07:08:04 +03:00
232bdd34a1
* rename conversions.js to deprecated-conversions.js * add a new Conversions component and switch by props FF * add a Details view to the new Conversions component * allow querying conversions with pagination ...and keep the current behaviour for DeprecatedConversions, always returning page=1 and limit=100 * hide some columns on mobile * prevent ListReport first column header overflow
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
import React from 'react';
|
|
import * as api from '../../api'
|
|
import * as url from '../../util/url'
|
|
import { escapeFilterValue } from '../../util/filters'
|
|
|
|
import { CR_METRIC } from '../reports/metrics';
|
|
import ListReport from '../reports/list';
|
|
|
|
export default function Conversions(props) {
|
|
const {site, query} = props
|
|
|
|
function fetchConversions() {
|
|
return api.get(url.apiPath(site, '/conversions'), query, {limit: 20})
|
|
}
|
|
|
|
function getFilterFor(listItem) {
|
|
return {goal: escapeFilterValue(listItem.name)}
|
|
}
|
|
|
|
return (
|
|
<ListReport
|
|
fetchData={fetchConversions}
|
|
getFilterFor={getFilterFor}
|
|
keyLabel="Goal"
|
|
metrics={[
|
|
{name: 'visitors', label: "Uniques", plot: true},
|
|
{name: 'events', label: "Total", hiddenOnMobile: true},
|
|
CR_METRIC,
|
|
{name: 'total_revenue', label: 'Revenue', hiddenOnMobile: true},
|
|
{name: 'average_revenue', label: 'Average', hiddenOnMobile: true}
|
|
]}
|
|
detailsLink={url.sitePath(site, '/conversions')}
|
|
query={query}
|
|
color="bg-red-50"
|
|
/>
|
|
)
|
|
}
|