mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
update UTM report to use new UTM columns
This commit is contained in:
parent
822ddee9ae
commit
6829d96862
4 changed files with 40 additions and 34 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue