mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Merge branch 'dev' of https://github.com/umami-software/umami into dev
This commit is contained in:
commit
0558563d35
11 changed files with 59 additions and 56 deletions
|
|
@ -3,6 +3,7 @@ import { unauthorized, json } from '@/lib/response';
|
|||
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
|
||||
import { getUTM, UTMParameters } from '@/queries';
|
||||
import { reportResultSchema } from '@/lib/schema';
|
||||
import { UTM_PARAMS } from '@/lib/constants';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const { auth, body, error } = await parseRequest(request, reportResultSchema);
|
||||
|
|
@ -20,7 +21,17 @@ export async function POST(request: Request) {
|
|||
const filters = await getQueryFilters(body.filters, websiteId);
|
||||
const parameters = await setWebsiteDate(websiteId, body.parameters);
|
||||
|
||||
const data = await getUTM(websiteId, parameters as UTMParameters, filters);
|
||||
const data = {
|
||||
utm_source: [],
|
||||
utm_medium: [],
|
||||
utm_campaign: [],
|
||||
utm_term: [],
|
||||
utm_content: [],
|
||||
};
|
||||
|
||||
for (const key of UTM_PARAMS) {
|
||||
data[key] = await getUTM(websiteId, { column: key, ...parameters } as UTMParameters, filters);
|
||||
}
|
||||
|
||||
return json(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export async function GET(
|
|||
}
|
||||
|
||||
if (type === 'channel') {
|
||||
const data = await getChannelExpandedMetrics(websiteId, { limit, offset }, filters);
|
||||
const data = await getChannelExpandedMetrics(websiteId, filters);
|
||||
|
||||
return json(data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue