Server events
Express
Send server-side conversions from Express — forwarded from the request, credited to the real visitor.
Fire a server-side conversion from an Express route handler, crediting the real visitor:
const express = require('express');const router = express.Router();router.post('/checkout/success', async (req, res) => { // First entry of X-Forwarded-For is the end user; fall back to Express's client IP. const forwardedFor = req.headers['x-forwarded-for']; const visitorIp = forwardedFor ? forwardedFor.split(',')[0].trim() : req.ip; await fetch('https://datalook.app/event', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ event_name: 'success', name: 'signup', page_path: req.path, ip: visitorIp, user_agent: req.get('user-agent') }) }); res.sendStatus(200);});module.exports = router;Note
Set app.set('trust proxy', true) so req.ip reflects the real client when X-Forwarded-For is absent.
How it’s credited
This reads the visitor’s IP and User-Agent from the request and forwards them, so the conversion lands on the real visitor — device, country, and source included. No
identify(), no ids, no cookie. Get an API key in the dashboard under Track it from your server; see the overview for the concepts and the webhook path.