import { AnalyticsInstance } from 'analytics'; /** * Create a server-side analytics instance with automatic context enrichment * * @example * ```tsx * "use server" * import { createServerAnalytics } from '@solid-analytics/solidstart/server' * * const analytics = createServerAnalytics(analyticsClient) * * export async function trackEvent(name: string, data: any) { * await analytics.track(name, data) * } * ``` */ export declare function createServerAnalytics(client: AnalyticsInstance, defaultOptions?: Omit): { track: (eventName: string, properties?: Record) => Promise; identify: (userId: string, traits?: Record) => Promise; page: (pageName?: string, properties?: Record) => Promise; batch: (events: Parameters[0]) => Promise; }; export declare interface RequestContext { ip?: string; userAgent?: string; referer?: string; country?: string; region?: string; city?: string; sessionId?: string; userId?: string; [key: string]: any; } /** * Server-side identify function * * @example * ```tsx * "use server" * import { serverIdentify } from '@solid-analytics/solidstart/server' * * export async function handleLogin(userId: string) { * await serverIdentify(userId, { email: 'user@example.com' }) * } * ``` */ export declare function serverIdentify(userId: string, traits?: Record, options?: ServerTrackOptions): Promise; /** * Server-side page function * * @example * ```tsx * "use server" * import { serverPage } from '@solid-analytics/solidstart/server' * * export async function trackPageView() { * await serverPage('Home', { section: 'landing' }) * } * ``` */ export declare function serverPage(pageName?: string, properties?: Record, options?: ServerTrackOptions): Promise; /** * Server-side track function * * @example * ```tsx * "use server" * import { serverTrack } from '@solid-analytics/solidstart/server' * * export async function handlePurchase() { * await serverTrack('purchase_completed', { amount: 99.99 }) * } * ``` */ export declare function serverTrack(eventName: string, properties?: Record, options?: ServerTrackOptions): Promise; /** * Batch server tracking for multiple events * * @example * ```tsx * "use server" * import { serverTrackBatch } from '@solid-analytics/solidstart/server' * * export async function trackUserFlow() { * await serverTrackBatch([ * { type: 'track', event: 'page_view' }, * { type: 'track', event: 'button_click', properties: { button: 'cta' } }, * ]) * } * ``` */ export declare function serverTrackBatch(events: Array<{ type: "track" | "identify" | "page"; event?: string; userId?: string; traits?: Record; properties?: Record; }>, options?: ServerTrackOptions): Promise; export declare interface ServerTrackOptions { /** * Analytics client instance (must be isomorphic) */ client?: AnalyticsInstance; /** * Enrich event with request context (IP, user agent, etc.) * @default true */ enrichContext?: boolean; /** * Extract session information from cookies * @default true */ includeSession?: boolean; /** * Debug logging * @default false */ debug?: boolean; } export { }