← Back
Track Pageviews for Your Vercel Logs
Step 1: Add a Log Drain
- Open your Vercel dashboard and select the team that owns your project
- Open Settings in the sidebar
- Click Drains
- Click the Add Drain button
- Select Logs as the data type
Step 2: Configure the Log Drain
- Name the drain something like
Known Agents Analytics - Under Projects, select Specific Projects
- Select the project you want to connect
- Select Static Files, Functions, Redirects, and Firewall
- Under Environment, select Production
- Click Next
Step 3: Configure the Destination
- Select Custom Endpoint
- Paste this into the URL field:
https://api.knownagents.com/logs/vercel
- For Encoding, select NDJSON
- Turn on Custom Headers
- For Custom Headers, paste this header:
Authorization: Bearer YOUR_ACCESS_TOKEN
- Navigate to the Known Agents Projects page and open your project
- Copy your access token from the Settings page
- Back in Vercel, swap in your access token where it says
YOUR_ACCESS_TOKEN - Click Create Drain
Step 4: Test Your Integration
- Navigate to the Projects page
- Select your project
- Click Settings
- Click Send a Test Visit
- Click Realtime
If your website is correctly connected, you should see visits from a test agent in the realtime timeline within a few seconds.