cosmic-analytics
Version:
Lightweight analytics for Cosmic projects
23 lines (20 loc) • 621 B
TypeScript
import { NextRequest } from 'next/server';
export { A as AnalyticsConfig, c as AnalyticsMetrics } from '../index-B31B8OmP.js';
interface EdgeAnalyticsConfig {
projectId: string;
apiEndpoint?: string;
sendInDevelopment?: boolean;
}
/**
* Track page view from edge runtime (middleware)
*/
declare function trackPageViewEdge(request: NextRequest, config: EdgeAnalyticsConfig): Promise<void>;
/**
* Extract geo information from request headers
*/
declare function getGeoInfo(request: NextRequest): {
country?: string;
region?: string;
city?: string;
};
export { getGeoInfo, trackPageViewEdge };