PostHog.AspNetCore
2.9.10
Prefix Reserved
dotnet add package PostHog.AspNetCore --version 2.9.10
NuGet\Install-Package PostHog.AspNetCore -Version 2.9.10
<PackageReference Include="PostHog.AspNetCore" Version="2.9.10" />
<PackageVersion Include="PostHog.AspNetCore" Version="2.9.10" />
<PackageReference Include="PostHog.AspNetCore" />
paket add PostHog.AspNetCore --version 2.9.10
#r "nuget: PostHog.AspNetCore, 2.9.10"
#:package PostHog.AspNetCore@2.9.10
#addin nuget:?package=PostHog.AspNetCore&version=2.9.10
#tool nuget:?package=PostHog.AspNetCore&version=2.9.10
PostHog ASP.NET Core SDK
Please see the main PostHog docs.
SDK usage examples and code snippets live in the official documentation so they stay up to date.
Documentation
Request span context
Disabled PostHog clients add no person or session tags to activities. The client uses the disabled state set when it was created.
UsePostHogRequestContext() adds sessionId and posthogDistinctId tags to the active request Activity, including an activity that started before the middleware. It preserves tags that the application already set. Missing IDs stay absent. These headers are client-controlled analytics context. Do not use them for authentication or authorization.
To also enrich child activities, register PostHog with the host builder's AddPostHog(), or call UseAspNetCore() when configuring PostHog services. The middleware activates a listener that the service provider disposes when the host stops. Child activities receive the request context when they start, so their tags remain available if they stop after the request ends. The listener does not change application sampling or create activities. OpenTelemetry is optional; the application keeps its existing provider, processors, and exporters.
Call the middleware before downstream code creates child activities. Configure forwarded headers before it when using a proxy. For stronger application identity, set posthogDistinctId explicitly when creating the activity, or set it with Activity.SetTag. Header values never replace explicit tags. New activities started after the request scope ends do not receive the ended scope's IDs. Background jobs need their own explicit context propagation.
This integration targets .NET 8 or later. The core SDK does not provide a native PostHog span API or a trace exporter. See the .NET setup guide for installation and request middleware setup.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.FeatureManagement (>= 4.8.0)
- PostHog (>= 2.17.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.9.10 | 129 | 10/23/2026 |
| 2.9.9 | 181 | 10/22/2026 |
| 2.9.8 | 80 | 10/22/2026 |
| 2.9.7 | 87,374 | 9/14/2026 |
| 2.9.6 | 16,104 | 9/4/2026 |
| 2.9.5 | 6,418 | 9/2/2026 |
| 2.9.4 | 6,950 | 9/1/2026 |
| 2.9.3 | 2,637 | 8/31/2026 |
| 2.9.2 | 9,479 | 8/26/2026 |
| 2.9.1 | 11,533 | 8/25/2026 |
| 2.9.0 | 4,040 | 8/24/2026 |
| 2.8.4 | 20,185 | 8/17/2026 |
| 2.8.3 | 1,889 | 8/14/2026 |
| 2.8.2 | 21,271 | 8/5/2026 |
| 2.8.1 | 15,133 | 7/30/2026 |
| 2.8.0 | 56,632 | 7/6/2026 |
| 2.7.5 | 978 | 7/3/2026 |
| 2.7.4 | 1,082 | 7/2/2026 |
| 2.7.3 | 412 | 7/2/2026 |
| 2.7.2 | 369 | 7/2/2026 |