PostHog 2.7.0

Prefix Reserved
dotnet add package PostHog --version 2.7.0
                    
NuGet\Install-Package PostHog -Version 2.7.0
                    
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" Version="2.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PostHog" Version="2.7.0" />
                    
Directory.Packages.props
<PackageReference Include="PostHog" />
                    
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 --version 2.7.0
                    
#r "nuget: PostHog, 2.7.0"
                    
#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@2.7.0
                    
#: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&version=2.7.0
                    
Install as a Cake Addin
#tool nuget:?package=PostHog&version=2.7.0
                    
Install as a Cake Tool

PostHog .NET SDK

This is a client SDK for the PostHog API written in C#. This is the core implementation of PostHog.

Goals

The goal of this package is to be usable in multiple .NET environments. At this moment, we are far short of that goal. We only support ASP.NET Core via PostHog.AspNetCore.

Docs

More detailed docs for using this library can be found at PostHog Docs for the .NET Client SDK.

Usage

To use this package, create an instance of PostHogClient and call the appropriate methods. Here's an example:

using PostHog;

var client = new PostHogClient(new PostHogOptions { ProjectToken = "YOUR_PROJECT_TOKEN" });
client.Capture("user-123", "Test Event");

For console apps, scripts, or other places where passing a client instance around is inconvenient, you can configure a process-wide default client and use the PostHogSdk facade:

using PostHog;
using PostHog.Sdk;

PostHogSdk.Init(new PostHogOptions { ProjectToken = "YOUR_PROJECT_TOKEN" });
PostHogSdk.Capture("user-123", "Test Event");

await PostHogSdk.ShutdownAsync();

You can also assign an existing client:

using PostHog;
using PostHog.Sdk;

var client = new PostHogClient(new PostHogOptions { ProjectToken = "YOUR_PROJECT_TOKEN" });
PostHogSdk.DefaultClient = client;

PostHogSdk.Capture("user-123", "Test Event");

If no default client is configured, PostHogSdk methods are no-ops and log a warning once through Microsoft.Extensions.Logging. To enable SDK logs for the static facade and clients created by PostHogSdk.Init, set PostHogSdk.LoggerFactory before calling SDK methods:

using Microsoft.Extensions.Logging;
using PostHog.Sdk;

using var loggerFactory = LoggerFactory.Create(builder =>
{
    builder.AddConsole();
    builder.SetMinimumLevel(LogLevel.Information);
});

PostHogSdk.LoggerFactory = loggerFactory;
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on PostHog:

Package Downloads
PostHog.AspNetCore

Package Description

PostHog.AI

AI Observability for .NET applications using PostHog. Intercepts and traces OpenAI and Azure OpenAI requests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.7.0 208 5/7/2026
2.6.2 730 5/6/2026
2.6.1 441 5/5/2026
2.6.0 1,522 5/1/2026
2.5.0 12,317 4/23/2026
2.4.3 5,411 4/21/2026
2.4.2 145 4/21/2026
2.4.1 35,014 3/19/2026
2.4.0 29,281 3/5/2026
2.3.2 6,788 2/27/2026
2.3.1 170 2/27/2026
2.3.0 3,353 2/26/2026
2.2.2 182,914 11/21/2025
2.2.1 58,332 10/22/2025
2.2.0 2,785 10/17/2025
2.1.0 3,190 10/14/2025
2.0.1 24,855 9/28/2025
2.0.0 72,137 8/26/2025
1.0.8 39,459 8/7/2025
1.0.7 37,379 7/21/2025
Loading failed