Amplitude.Experiment 1.0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Amplitude.Experiment --version 1.0.0.1                
NuGet\Install-Package Amplitude.Experiment -Version 1.0.0.1                
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="Amplitude.Experiment" Version="1.0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Amplitude.Experiment --version 1.0.0.1                
#r "nuget: Amplitude.Experiment, 1.0.0.1"                
#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.
// Install Amplitude.Experiment as a Cake Addin
#addin nuget:?package=Amplitude.Experiment&version=1.0.0.1

// Install Amplitude.Experiment as a Cake Tool
#tool nuget:?package=Amplitude.Experiment&version=1.0.0.1                

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.6 193 9/7/2023
1.0.0.5 119 9/6/2023
1.0.0.4 183 4/20/2023
1.0.0.3 168 4/19/2023
1.0.0.2 162 4/19/2023
1.0.0.1 162 4/19/2023
1.0.0 171 4/19/2023