Audit log tracking must be done server-side because your API key should never be exposed to the browser. This guide covers patterns for Next.js App Router with Server Actions and middleware.
Never use your imk_ API key in client-side code, use client components, or any code that runs in the browser. API keys in client-side bundles are visible to anyone inspecting your page source.