Skip to main content
Use Next.js middleware to forward data to the Log visit endpoint. In Next.js, Middleware allows you to run code before a request is completed. Read the official documentation for more details.

Setup

  1. Set up the HALL_API_KEY environment variable with your Hall API key.
  2. Create a middleware.ts file in your Next.js project root to implement the analytics middleware.

Example

The example below demonstrates how to forward data from Next.js headers function.
middleware.ts