Add audit analytics and campaign metrics
This commit is contained in:
29
app/api/internal/rybbit/audit/route.ts
Normal file
29
app/api/internal/rybbit/audit/route.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { fetchRybbitAuditAnalytics } from "@/lib/rybbit-analytics";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const url = new URL(request.url);
|
||||
const auditPath = url.searchParams.get("path") ?? "";
|
||||
|
||||
if (!auditPath.startsWith("/audit/")) {
|
||||
return Response.json({
|
||||
ok: false,
|
||||
error: "Audit-Pfad fehlt.",
|
||||
data: null,
|
||||
}, { status: 400 });
|
||||
}
|
||||
|
||||
const result = await fetchRybbitAuditAnalytics({
|
||||
apiUrl: process.env.RYBBIT_API_URL,
|
||||
apiKey: process.env.RYBBIT_API_KEY,
|
||||
siteId: process.env.NEXT_PUBLIC_RYBBIT_SITE_ID,
|
||||
auditPath,
|
||||
startDate: url.searchParams.get("startDate") ?? undefined,
|
||||
endDate: url.searchParams.get("endDate") ?? undefined,
|
||||
});
|
||||
|
||||
if (!result.ok) {
|
||||
return Response.json({ ok: false, error: result.error, data: result.data });
|
||||
}
|
||||
|
||||
return Response.json({ ok: true, data: result.data });
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
import { DashboardPlaceholderPage } from "@/components/dashboard-placeholder-page";
|
||||
import { AnalyticsDashboard } from "@/components/analytics/analytics-dashboard";
|
||||
|
||||
export default function AnalyticsPage() {
|
||||
return (
|
||||
<DashboardPlaceholderPage
|
||||
description="Kampagnenmetriken und Rybbit-Daten folgen in TASK-17 und TASK-19."
|
||||
title="Analytics"
|
||||
/>
|
||||
);
|
||||
return <AnalyticsDashboard />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user