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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PostHog.AspNetCore" Version="2.9.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PostHog.AspNetCore" Version="2.9.10" />
                    
Directory.Packages.props
<PackageReference Include="PostHog.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PostHog.AspNetCore --version 2.9.10
                    
#r "nuget: PostHog.AspNetCore, 2.9.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PostHog.AspNetCore@2.9.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PostHog.AspNetCore&version=2.9.10
                    
Install as a Cake Addin
#tool nuget:?package=PostHog.AspNetCore&version=2.9.10
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed