Server events
ASP.NET Core
Send server-side conversions from ASP.NET Core — forwarded from the request, credited to the real visitor.
Fire a server-side conversion from a minimal API endpoint:
using System.Net.Http.Headers;app.MapPost("/checkout/success", async (HttpContext context, IHttpClientFactory httpClientFactory) =>{ var forwardedFor = context.Request.Headers["X-Forwarded-For"].ToString(); var visitorIp = !string.IsNullOrEmpty(forwardedFor) ? forwardedFor.Split(',')[0].Trim() : context.Connection.RemoteIpAddress?.ToString(); var userAgent = context.Request.Headers.UserAgent.ToString(); var client = httpClientFactory.CreateClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://datalook.app/event"); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY"); request.Content = JsonContent.Create(new { event_name = "success", name = "signup", page_path = context.Request.Path.Value, ip = visitorIp, user_agent = userAgent }); await client.SendAsync(request); return Results.Ok();});Note
JsonContent.Create lives in System.Net.Http.Json (referenced by default in the ASP.NET Core shared framework), so no extra package is 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.