Skip to content

f-inc/PostHog.NET

 
 

Repository files navigation

Community .NET package for PostHog

Build

CircleCI

Get Package

You can get PostHog.NET by grabbing the latest NuGet package.

Get Started

Register the service

services.AddPostHog("api-key", config =>
            {
                // leave empty if you are not self-hosting 
                config.Host = "example.com";
            });

Inject IPostHogClient

private readonly IPostHogClient _postHogClient;

public WeatherForecastController(IPostHogClient postHogClient)
{
    _postHogClient = postHogClient;
}

then call a desired method

var properties = new Properties()
                .SetEventProperty("event", "value")
                .SetUserProperty("user-property-to-set", "value") // $set equivalent
                .SetUserPopertyOnce("user-property-to-set-once", "value"); // $set_once equivalent

_postHogClient.Capture("a86818cc-c84e-4453-9c48-d7bb636e7f2d", "Fetch weather forecast", properties);

Thanks

This library is largely based on the Analytics.NET package.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%