Skip to content

RudderStack's .NET SDK for event tracking from your .NET applications.

License

Notifications You must be signed in to change notification settings

rudderlabs/rudder-sdk-.net

 
 

Repository files navigation

What is RudderStack?

RudderStack is a customer data pipeline tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.

More information on RudderStack can be found here.

Released under the MIT License.

Latest Version

2.0.0

Getting Started with .NET SDK

Install RudderAnalytics using NuGet

Install-Package RudderAnalytics -Version 2.0.0

Migrating from v1 to v2

The Gzip feature is enabled by default in the .NET SDK from version 2.0.0. Refer to Gzipping requests section for more details.

Initialize the Client

using RudderStack;

RudderAnalytics.Initialize(
    WRITE_KEY,
    new RudderConfig(dataPlaneUrl: DATA_PLANE_URL)
);

Gzipping requests

The Gzip feature is enabled by default in the .NET SDK from version 2.0.0.

The .NET SDK automatically gzips requests. However, you can disable this by setting the gzip parameter of RudderConfig to false while initializing the SDK, as shown:

using RudderStack;

RudderAnalytics.Initialize(
    WRITE_KEY,
    new RudderConfig(dataPlaneUrl: DATA_PLANE_URL, gzip: false)
);

Gzip requires rudder-server v1.4 or higher. Otherwise, your events might fail.

Send Events

RudderAnalytics.Client.Track(
    "userId",
    "CTA Clicked",
    new Dictionary<string, object> { {"plan", "premium"}, }
);

Setup .env for running the sample apps

  • Make a copy of sample.env in the root folder and replace DUPLICATE_WRITE_KEY and DUPLICATE_DATA_PLANE with the actual values from your dashboard.

Setup Husky for Pre-Commit Hooks

  • Husky.Net is used to run pre-commit hooks, which would format all the C# code in the staging section. In order to run these hooks you need to setup Husky.Net using the instructions here

Contact Us

If you come across any issues while configuring or using this integration, please feel free to start a conversation on our Slack channel. We will be happy to help you.

About

RudderStack's .NET SDK for event tracking from your .NET applications.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.7%
  • Other 0.3%