Server events
Nuxt
Send server-side conversions from a Nuxt server route — forwarded from the request, credited to the real visitor.
Send a server-side conversion from a Nuxt server route (Nitro/H3):
export default defineEventHandler(async (event) => { // Prefer the FIRST X-Forwarded-For entry (the real visitor); else H3's client IP. const xff = getRequestHeader(event, 'x-forwarded-for') const ip = xff ? xff.split(',')[0].trim() : getRequestIP(event) await $fetch('https://datalook.app/event', { method: 'POST', headers: { Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: { event_name: 'success', name: 'signup', page_path: getRequestURL(event).pathname, ip, user_agent: getRequestHeader(event, 'user-agent') } }) return { ok: true }})Note
In Nitro server routes these H3 utilities (defineEventHandler, getRequestURL, getRequestIP, getRequestHeader) and $fetch are auto-imported, so no import statements are needed.
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.