Amplitude.Experiment
1.0.0.2
See the version list below for details.
dotnet add package Amplitude.Experiment --version 1.0.0.2
NuGet\Install-Package Amplitude.Experiment -Version 1.0.0.2
<PackageReference Include="Amplitude.Experiment" Version="1.0.0.2" />
paket add Amplitude.Experiment --version 1.0.0.2
#r "nuget: Amplitude.Experiment, 1.0.0.2"
// Install Amplitude.Experiment as a Cake Addin #addin nuget:?package=Amplitude.Experiment&version=1.0.0.2 // Install Amplitude.Experiment as a Cake Tool #tool nuget:?package=Amplitude.Experiment&version=1.0.0.2
Unofficial Amplitude Experiment SDK for .NET
The unofficial .NET SDK for Amplitude Experiment is a Software Development Kit (SDK) developed to integrate Amplitude's Experimentation functionality with .NET applications. The SDK provides a set of classes that allow you to easily run A/B tests. With this SDK, you can quickly integrate Amplitude Experimentation into your applications and test different variations of your software to identify the most effective changes. The unofficial .NET SDK for Amplitude Experiment is not officially supported by Amplitude, but it offers an alternative solution for those who work with the .NET framework.
Install
Install the unofficial .NET SDK for Amplitude Experiment via NuGet by running the following command in the Package Manager Console:
Install-Package Amplitude.Experiment
Usage
Once installed, import the Amplitude.Experiment
namespace into your project.
using Amplitude.Experiment;
Create an instance of the ExperimentClient
class, passing in your Amplitude Deployment API key:
var client = new ExperimentClient("<your-api-key>");
Use the client object to get variants:
var client = new ExperimentClient("<your-api-key>");
var variants = await client.VariantAsync("<your-flag-key>");
if(variants.First().Value == "on") {
// the flag is enabled
} else {
// the flag is not enabled
}
Usage with additional context
Set context with ExperimentUser when you initialize the SDK, it will be used for every request to retreive variants. The ExperimentUser can impact the value of the variant.
ExperimentUser
Experiment users map to a user within Amplitude Analytics. Alongside flag configurations, users are an input to evaluation. Flag and experiment targeting rules can make use of user properties.
Context is an optional JSON of custom properties used when evaluating the user during evaluation.
var user = new ExperimentUser(){ UserId = "test", DeviceId = "UserAgent 1", context = @"{"plan":"premium"}" }
You can pass the user when you initialize the SDK or when you retreive variants.
var client = new ExperimentClient("<your-api-key>", user);
You can also supply ExperimentUser during the call to VariantAsync to override the ExperimentUser supplied during initialization.
var variants = await client.VariantAsync("<your-flag-key>", user);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 was computed. 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. |
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Newtonsoft.Json (>= 13.0.2)
-
net6.0
- Newtonsoft.Json (>= 13.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.