diff --git a/app/analytics/page.tsx b/app/analytics/page.tsx index 692c209..2df59fc 100644 --- a/app/analytics/page.tsx +++ b/app/analytics/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect } from 'react'; +import React, { useState, useEffect, Suspense } from 'react'; import { format, subDays } from 'date-fns'; import { DateRangePicker } from '@/app/components/ui/DateRangePicker'; import TimeSeriesChart from '@/app/components/charts/TimeSeriesChart'; @@ -11,9 +11,8 @@ import { EventsSummary, TimeSeriesData, GeoData, DeviceAnalytics as DeviceAnalyt import { TeamSelector } from '@/app/components/ui/TeamSelector'; import { ProjectSelector } from '@/app/components/ui/ProjectSelector'; import { TagSelector } from '@/app/components/ui/TagSelector'; -import { useSearchParams } from 'next/navigation'; +import { useSearchParams, useRouter } from 'next/navigation'; import { useShortUrlStore } from '@/app/utils/store'; -import { useRouter } from 'next/navigation'; // 事件类型定义 interface Event { @@ -116,7 +115,8 @@ const extractEventInfo = (event: Event) => { }; }; -export default function AnalyticsPage() { +// Analytics Content Component that uses URL parameters +function AnalyticsContent() { // 从 URL 获取查询参数 const searchParams = useSearchParams(); const router = useRouter(); @@ -834,6 +834,7 @@ export default function AnalyticsPage() { teamIds={selectedTeamIds} projectIds={selectedProjectIds} tagIds={selectedTagNames} + linkId={selectedShortUrl?.externalId} /> @@ -1190,4 +1191,17 @@ export default function AnalyticsPage() { ); +} + +// Main page component with Suspense +export default function AnalyticsPage() { + return ( + +
+
+ }> + +
+ ); } \ No newline at end of file diff --git a/app/api/events/utm/route.ts b/app/api/events/utm/route.ts index 2286445..a9b1f4f 100644 --- a/app/api/events/utm/route.ts +++ b/app/api/events/utm/route.ts @@ -34,6 +34,19 @@ export async function GET(request: NextRequest) { // 获取UTM类型参数 const utmType = searchParams.get('utmType') || 'source'; + // 添加调试日志 + console.log('UTM API received parameters:', { + startTime, + endTime, + linkId, + teamIds, + projectIds, + tagIds, + tagNames, + utmType, + url: request.url + }); + // 构建WHERE子句 let whereClause = ''; const conditions = [];