PostHog 2.7.0
Prefix Reserveddotnet add package PostHog --version 2.7.0
NuGet\Install-Package PostHog -Version 2.7.0
<PackageReference Include="PostHog" Version="2.7.0" />
<PackageVersion Include="PostHog" Version="2.7.0" />
<PackageReference Include="PostHog" />
paket add PostHog --version 2.7.0
#r "nuget: PostHog, 2.7.0"
#:package PostHog@2.7.0
#addin nuget:?package=PostHog&version=2.7.0
#tool nuget:?package=PostHog&version=2.7.0
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 | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- System.Net.Http.Json (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
- System.Threading.Channels (>= 8.0.0)
-
.NETStandard 2.1
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- System.Net.Http.Json (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
- System.Threading.Channels (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
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 |