feat: Create analytics summary API endpoint to provide QR scan metrics, trends, and performance.
This commit is contained in:
parent
036500f6d1
commit
749cabf0bf
|
|
@ -149,7 +149,7 @@ export async function GET(request: NextRequest) {
|
|||
? Math.round((previousUniqueScans / previousTotalScans) * 100)
|
||||
: 0;
|
||||
|
||||
const avgScansTrend = calculateTrend(currentConversion, previousConversion);
|
||||
const avgScansTrend = calculateTrend(avgScansPerQR, previousAvgScansPerQR);
|
||||
|
||||
// Device stats
|
||||
const deviceStats = qrCodes.flatMap(qr => qr.scans)
|
||||
|
|
@ -245,7 +245,7 @@ export async function GET(request: NextRequest) {
|
|||
summary: {
|
||||
totalScans,
|
||||
uniqueScans,
|
||||
avgScansPerQR: currentConversion, // Now sending Unique Rate instead of Avg per QR
|
||||
avgScansPerQR,
|
||||
mobilePercentage,
|
||||
topCountry: topCountry ? topCountry[0] : 'N/A',
|
||||
topCountryPercentage: topCountry && totalScans > 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue