Server events
Remix
Send server-side conversions from a Remix action — forwarded from the request, credited to the real visitor.
Fire a server-side conversion from a Remix action:
import type { ActionFunctionArgs } from '@remix-run/node'export async function action({ request }: ActionFunctionArgs) { // ...complete the signup / charge the card here... const url = new URL(request.url) const forwardedFor = request.headers.get('X-Forwarded-For') const ip = forwardedFor ? forwardedFor.split(',')[0].trim() : '' const userAgent = request.headers.get('User-Agent') ?? '' 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: url.pathname, ip: ip, user_agent: userAgent }) }) return new Response(null, { status: 204 })}Note
In a Remix action the request is a standard Web Request, so read the path from new URL(request.url).pathname and the User-Agent and X-Forwarded-For straight off request.headers.
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.