An open API service indexing awesome lists of open source software.

https://github.com/wingify/vwo-dotnet-sdk

[DEPRECATED] VWO .NET SDK for server-side A/B Testing
https://github.com/wingify/vwo-dotnet-sdk

dotnet dotnet-sdk murmurhash3 netstandard20 server-side vwo vwo-dotnet

Last synced: 5 months ago
JSON representation

[DEPRECATED] VWO .NET SDK for server-side A/B Testing

Awesome Lists containing this project

README

          

# ⚠️ [DEPRECATED] VWO .NET SDK

**⚠️ This project is no longer actively developed. ⚠️**

**✅ We are only fixing critical bugs and security issues.**

**❌ No new features, enhancements, or non-critical updates will be added.**

#### Switch to *VWO Feature Management & Experimentation(FME)* – The Better Alternative! 🚀

VWO’s FME product empowers teams to seamlessly test, release, optimize, and roll back features across their entire tech stack while minimizing risk and maximizing business impact.

* Check out FME developer documentation [here](https://developers.vwo.com/v2/docs/fme-overview).
* Check [this](https://developers.vwo.com/v2/docs/sdks-release-info ) for the list of all FME-supported SDKs.

**💡 Need Help?**
For migration assistance or any questions, contact us at [support@vwo.com](support@vwo.com)

------

[![NuGet](https://img.shields.io/nuget/v/VWO.Sdk.svg?style=plastic)](https://www.nuget.org/packages/VWO.Sdk/)
[![CI](https://github.com/wingify/vwo-dotnet-sdk/workflows/CI/badge.svg?branch=master)](https://github.com/wingify/vwo-dotnet-sdk/actions?query=workflow%3ACI)

[![codecov](https://codecov.io/gh/wingify/vwo-dotnet-sdk/branch/master/graph/badge.svg?token=813UYYMWGM)](https://codecov.io/gh/wingify/vwo-dotnet-sdk)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)

This open source library allows you to A/B Test your Website at server-side.

## Requirements

- Works with NetStandard: 2.0 onwards.

## Installation

```bash
PM> Install-Package VWO.Sdk
```

## Basic usage

**Using and Instantiation**

```c#
using VWOSdk;

Settings settingsFile = VWO.GetSettingsFile(accountId, sdkKey); // Fetch settingsFile from VWO.
IVWOClient vwoClient = VWO.Launch(settingsFile); // Create VWO Client to user APIs.
```

**API usage**

```c#
using System.Collections.Generic;

// Activate API
// Without Custom Variable
public static Dictionary options = new Dictionary(){};
string variationName = vwoClient.Activate(campaignKey, userId, options);

// With Custom Variable , variation targeting variable
public readonly static Dictionary options = new Dictionary()
{
{
"customVariables", new Dictionary()
{
{"price", 100.1}
},
"variationTargetingVariables", new Dictionary()
{
{"team", "qa-internal"}
}
}
};

string variationName = vwoClient.Activate(campaignKey, userId, options);

// GetVariationName API
// Without Custom Variable
public static Dictionary options = new Dictionary(){};
string variationName = vwoClient.GetVariationName(campaignKey, userId, options);

// With Custom Variable snd variation targeting variable
public static Dictionary options = new Dictionary()
{
{
"customVariables", new Dictionary()
{
{"price", '40'}
}
"variationTargetingVariables", new Dictionary()
{
{"team", "qa-internal"}
}
}
};
string variationName = vwoClient.GetVariationName(campaignKey, userId, options);

// Track API
// For CUSTOM CONVERSION Goal
bool isSuccessful = vwoClient.Track(campaignKey, userId, goalIdentifier);

// For Goal Conversion in Multiple Campaign
Dictionary result = vwoClient.Track(List () { campaignKey1 campaignKey2 }, userId, goalIdentifier);

// For Goal Conversion in All Possible Campaigns
Dictionary result = vwoClient.Track(userId, goalIdentifier);

// Without Revenue Value and Custom Variable
Dictionary options = new Dictionary(){};
bool isSuccessful = vwoClient.Track(campaignKey, userId, goalIdentifier, options);

// For only Revenue Value
public static Dictionary options = new Dictionary()
{
{ "revenueValue", 10.2 },
};
bool isSuccessful = vwoClient.Track(campaignKey, userId, goalIdentifier, options);

// For only Custom Variable
public static Dictionary options = new Dictionary()
{
{
"customVariables", new Dictionary()
{
{"location", 'India'}
}
}
};
bool isSuccessful = vwoClient.Track(campaignKey, userId, goalIdentifier, options);

// For Revenue Value and Custom Variable and Variation Targeting varaible
public static Dictionary options = new Dictionary()
{
{
"revenue_value", 10
},
{
"customVariables", new Dictionary()
{
{
"gender", "f"
}
}
},
{
"variationTargetingVariables", new Dictionary()
{
{
"abcd", 1
}
}
}
};
bool isSuccessful = vwoClient.Track(campaignKey, userId, goalIdentifier, options);

//IsFeatureEnabled API
//Without Custom Variable
public static Dictionary options = new Dictionary(){};
bool isSuccessful = vwo.Client.IsFeatureEnabled(campaignKey, userId, options);

//With Custom Variable
public static Dictionary options = new Dictionary()
{
{
"customVariables", new Dictionary()
{
{"value", 10}
}
}
};
bool isSuccessful = vwo.Client.IsFeatureEnabled(campaignKey, userId, options);

//GetFeatureVariableValue API
//Without Custom Variable
Dictionary options = new Dictionary(){};
dynamic variableValue = vwo.Client.GetFeatureVariableValue(campaignKey, variableKey, userId, options);

//With Custom Variable
public static Dictionary options = new Dictionary()
{
{
"customVariables", new Dictionary()
{
{"value", 10}
}
}
};
dynamic variableValue = vwo.Client.GetFeatureVariableValue(campaignKey, variableKey, userId, options);

//Push API
bool isSuccessful = vwo.Client.Push(tagKey, tagValue, userId);

//Pass TagKey
var TagKey = "abc";
bool isSuccessful = vwo.Client.Push(TagKey, tagValue, userId);

//Pass TagValue
var TagValue = "abc";
bool isSuccessful = vwo.Client.Push(tagKey, TagValue, userId);
```

**Configure Log Level**

```c#
VWO.Configure(LogLevel.DEBUG);
```

**Implement and Configure Custom Logger** - implement your own logger class

```c#
using VWOSdk;

public class CustomLogWriter : ILogWriter
{
public void WriteLog(LogLevel logLevel, string message)
{
// ...write to file or database or integrate with any third-party service
}
}

// Configure Custom Logger with SDK.
VWO.Configure(new CustomLogWriter());
```

**User Storage Service**

```c#
using VWOSdk;

public class UserStorageService : IUserStorageService
{
public UserStorageMap Get(string userId)
{
// ...code here for getting data
// return data
}

public void Set(UserStorageMap userStorageMap)
{
// ...code to persist data
}
}

var settingsFile = VWO.GetSettingsFile(VWOConfig.AccountId, VWOConfig.SdkKey);

// Provide UserStorageService instance while vwoClient Instantiation.
var vwoClient = VWO.Launch(settingsFile, userStorageService: new UserStorageService());

// Set specific goalType to Track
// Available GoalTypes - GoalTypes.REVENUE, GoalTypes.CUSTOM, GoalTypes.ALL (Default)
var vwoClient = VWO.Launch(settingsFile, goalTypeToTrack: Constants.GoalTypes.REVENUE);

// Set if a return user should be tracked, default false
var vwoClient = VWO.Launch(settingsFile, shouldTrackReturningUser: true);
```

## Documentation

Refer [Official VWO Documentation](https://developers.vwo.com/reference#fullstack-introduction)

## Demo NetStandard application

[vwo-dotnet-sdk-example](https://github.com/wingify/vwo-dotnet-sdk-example)

## Setting Up development environment

```bash
chmod +x start-dev.sh;
bash start-dev.sh;
```

It will install the git-hooks necessary for commiting and pushing the code. Commit-messages follow a [guideline](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). All test cases must pass before pushing the code.

## Running Unit Tests

```bash
dotnet test
```

## Third-party Resources and Credits

Refer [third-party-attributions.txt](https://github.com/wingify/vwo-dotnet-sdk/blob/master/third-party-attributions.txt)

## Authors

- Main Contributor - [Sidhant Gakhar](https://github.com/sidhantgakhar)
- Repo health maintainer - [Varun Malhotra](https://github.com/softvar)([@s0ftvar](https://twitter.com/s0ftvar))

## Changelog

Refer [CHANGELOG.md](https://github.com/wingify/vwo-dotnet-sdk/blob/master/CHANGELOG.md)

## Contributing

Please go through our [contributing guidelines](https://github.com/wingify/vwo-dotnet-sdk/CONTRIBUTING.md)

## Code of Conduct

[Code of Conduct](https://github.com/wingify/vwo-dotnet-sdk/blob/master/CODE_OF_CONDUCT.md)

## License

[Apache License, Version 2.0](https://github.com/wingify/vwo-dotnet-sdk/blob/master/LICENSE)

Copyright 2019-2021 Wingify Software Pvt. Ltd.