feat: add client screen size statics

pull/957/head
Serkan KONAKCI 2022-02-14 11:29:41 +03:00
parent a035fbb581
commit da09e5cdf7
8 changed files with 42398 additions and 4349 deletions

View File

@ -0,0 +1,15 @@
import React from 'react';
import MetricsTable from './MetricsTable';
import { FormattedMessage } from 'react-intl';
export default function ScreenTable({ websiteId, ...props }) {
return (
<MetricsTable
{...props}
title={<FormattedMessage id="metrics.screens" defaultMessage="Screen" />}
type="screen"
metric={<FormattedMessage id="metrics.visitors" defaultMessage="Visitors" />}
websiteId={websiteId}
/>
);
}

View File

@ -23,6 +23,7 @@ import useFetch from 'hooks/useFetch';
import usePageQuery from 'hooks/usePageQuery'; import usePageQuery from 'hooks/usePageQuery';
import useShareToken from 'hooks/useShareToken'; import useShareToken from 'hooks/useShareToken';
import { DEFAULT_ANIMATION_DURATION, TOKEN_HEADER } from 'lib/constants'; import { DEFAULT_ANIMATION_DURATION, TOKEN_HEADER } from 'lib/constants';
import ScreenTable from 'components/metrics/ScreenTable';
const views = { const views = {
url: PagesTable, url: PagesTable,
@ -68,6 +69,10 @@ export default function WebsiteDetails({ websiteId }) {
label: <FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />, label: <FormattedMessage id="metrics.referrers" defaultMessage="Referrers" />,
value: resolve({ view: 'referrer' }), value: resolve({ view: 'referrer' }),
}, },
{
label: <FormattedMessage id="metrics.screens" defaultMessage="Screens" />,
value: resolve({ view: 'screen' }),
},
{ {
label: <FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />, label: <FormattedMessage id="metrics.browsers" defaultMessage="Browsers" />,
value: resolve({ view: 'browser' }), value: resolve({ view: 'browser' }),
@ -130,12 +135,15 @@ export default function WebsiteDetails({ websiteId }) {
{chartLoaded && !view && ( {chartLoaded && !view && (
<GridLayout> <GridLayout>
<GridRow> <GridRow>
<GridColumn md={12} lg={6}> <GridColumn md={12} lg={4}>
<PagesTable {...tableProps} /> <PagesTable {...tableProps} />
</GridColumn> </GridColumn>
<GridColumn md={12} lg={6}> <GridColumn md={12} lg={4}>
<ReferrersTable {...tableProps} /> <ReferrersTable {...tableProps} />
</GridColumn> </GridColumn>
<GridColumn md={12} lg={4}>
<ScreenTable {...tableProps} />
</GridColumn>
</GridRow> </GridRow>
<GridRow> <GridRow>
<GridColumn md={12} lg={4}> <GridColumn md={12} lg={4}>

View File

@ -104,5 +104,7 @@
"metrics.referrers": "Referrers", "metrics.referrers": "Referrers",
"metrics.unique-visitors": "Unique visitors", "metrics.unique-visitors": "Unique visitors",
"metrics.views": "Views", "metrics.views": "Views",
"metrics.visitors": "Visitors" "metrics.visitors": "Visitors",
"metrics.screens": "Screens"
} }

View File

@ -104,5 +104,6 @@
"metrics.referrers": "Referrers", "metrics.referrers": "Referrers",
"metrics.unique-visitors": "Unique visitors", "metrics.unique-visitors": "Unique visitors",
"metrics.views": "Views", "metrics.views": "Views",
"metrics.visitors": "Visitors" "metrics.visitors": "Visitors",
"metrics.screens": "Screens"
} }

View File

@ -104,5 +104,6 @@
"metrics.referrers": "Yönlendirenler", "metrics.referrers": "Yönlendirenler",
"metrics.unique-visitors": "Tekil kullanıcı", "metrics.unique-visitors": "Tekil kullanıcı",
"metrics.views": "Görüntüleme", "metrics.views": "Görüntüleme",
"metrics.visitors": "Ziyaretçi" "metrics.visitors": "Ziyaretçi",
"metrics.screens": "Ekranlar"
} }

36717
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ import { getPageviewMetrics, getSessionMetrics, getWebsiteById } from 'lib/queri
import { ok, methodNotAllowed, unauthorized, badRequest } from 'lib/response'; import { ok, methodNotAllowed, unauthorized, badRequest } from 'lib/response';
import { allowQuery } from 'lib/auth'; import { allowQuery } from 'lib/auth';
const sessionColumns = ['browser', 'os', 'device', 'country', 'language']; const sessionColumns = ['browser', 'os', 'device', 'country', 'screen', 'language'];
const pageviewColumns = ['url', 'referrer']; const pageviewColumns = ['url', 'referrer'];
function getTable(type) { function getTable(type) {

9991
yarn.lock

File diff suppressed because it is too large Load Diff