{"id":19541309,"url":"https://github.com/wingify/vwo-fme-dotnet-sdk","last_synced_at":"2026-01-08T11:06:55.494Z","repository":{"id":251928288,"uuid":"838731896","full_name":"wingify/vwo-fme-dotnet-sdk","owner":"wingify","description":"VWO Feature Management and Experimentation SDK for .NET","archived":false,"fork":false,"pushed_at":"2025-01-27T07:45:33.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-27T08:29:03.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/VWO.FME.Sdk/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wingify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T08:28:10.000Z","updated_at":"2025-01-27T07:45:37.000Z","dependencies_parsed_at":"2024-08-06T16:22:40.556Z","dependency_job_id":"7b18bf0e-d1a9-456f-9675-3ffa571cc55f","html_url":"https://github.com/wingify/vwo-fme-dotnet-sdk","commit_stats":null,"previous_names":["wingify/vwo-fme-dotnet-sdk"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-fme-dotnet-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-fme-dotnet-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-fme-dotnet-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingify%2Fvwo-fme-dotnet-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wingify","download_url":"https://codeload.github.com/wingify/vwo-fme-dotnet-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240795087,"owners_count":19858740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:09:37.098Z","updated_at":"2026-01-08T11:06:55.488Z","avatar_url":"https://github.com/wingify.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VWO Feature Management and Experimentation SDK for .NET\n\n[![NuGet](https://img.shields.io/nuget/v/VWO.FME.Sdk.svg?style=plastic)](https://www.nuget.org/packages/VWO.FME.Sdk/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\n## Overview\n\nThe **VWO Feature Management and Experimentation SDK** (VWO FME Dotnet SDK) enables dotnet developers to integrate feature flagging and experimentation into their applications. This SDK provides full control over feature rollout, A/B testing, and event tracking, allowing teams to manage features dynamically and gain insights into user behavior.\n\n---\n\n## Requirements\n\n- **.NET Standard 2.0** or higher\n- Compatible with the following **.NET** implementations:\n  - **.NET Core 3.1+** (LTS, supported)\n  - **.NET Framework 4.6.1+**\n  - **.NET 5+** (End-of-life, not recommended for new projects)\n  - **.NET 6+** (LTS, recommended for new projects)\n  - **.NET 7+** (latest stable version)\n\n---\n\n## Installation\n\nInstall the SDK using the .NET CLI or NuGet Package Manager:\n\n### Using .NET CLI\n```bash\n\u003e dotnet add package VWO.FME.Sdk\n```\n\n### Using Package Manager\n```bash\nPM\u003e Install-Package VWO.FME.Sdk\n```\n\n---\n\n## Basic Usage Example\n\nThe following example demonstrates initializing the SDK, creating a user context, checking if a feature flag is enabled, and tracking a custom event:\n\n```csharp\nusing VWOFmeSdk;\nusing VWOFmeSdk.Models.User;\n\nclass Program\n{\n    static void Main(string[] args)\n    {\n        // Initialize VWO SDK with your account details\n        var vwoInitOptions = new VWOInitOptions\n        {\n            SdkKey = \"32-alpha-numeric-sdk-key\", // Replace with your SDK key\n            AccountId = 123456 // Replace with your account ID\n        };\n\n        var vwoInstance = VWO.Init(vwoInitOptions);\n\n        // Create user context\n        var context = new VWOContext\n        {\n            Id = \"unique_user_id\" // Set a unique user identifier\n        };\n\n        // Check if a feature flag is enabled\n        var getFlag = vwoInstance.GetFlag(\"feature_key\", context);\n        bool isFeatureEnabled = getFlag.IsEnabled();\n        Console.WriteLine($\"Is feature enabled? {isFeatureEnabled}\");\n\n        // Get a variable value with a default fallback\n        var variableValue = getFlag.GetVariable(\"feature_variable\", \"default_value\");\n        Console.WriteLine($\"Variable value: {variableValue}\");\n\n        // Track a custom event\n        var eventProperties = new Dictionary\u003cstring, object\u003e { { \"revenue\", 100 } };\n        var trackResponse = vwoInstance.TrackEvent(\"event_name\", context, eventProperties);\n        Console.WriteLine(\"Event tracked: \" + trackResponse);\n\n        // Set a custom attribute\n        vwoInstance.SetAttribute(\"attribute_key\", \"attribute_value\", context);\n    }\n}\n```\n\n---\n\n## Advanced Configuration Options\n\nTo customize the SDK further, additional parameters can be passed to the `init()` API. Here's a table describing each option:\n\n| **Parameter**          | **Description**                                                                                                     | **Required** | **Type**        | **Example**                     |\n|------------------------|---------------------------------------------------------------------------------------------------------------------|--------------|-----------------|---------------------------------|\n| `SdkKey`               | SDK key for authenticating your application with VWO.                                                              | Yes          | `string`        | `\"32-alpha-numeric-sdk-key\"`   |\n| `AccountId`            | VWO Account ID for authentication.                                                                                 | Yes          | `int`           | `123456`                        |\n| `PollInterval`         | Time interval (in milliseconds) for fetching updates from VWO servers.                                              | No           | `int`           | `60000`                         |\n| `Storage`              | Custom storage mechanism for persisting user decisions and campaign data.                                           | No           | `IStorage`      | See [Storage](#storage) section |\n| `Logger`               | Configure log levels and transport for debugging purposes.                                                          | No           | `ILogger`       | See [Logger](#logger) section   |\n| `Integrations`         | Callback function for integrating with third-party analytics services.                                              | No           | `Action`        | See [Integrations](#integrations) section |\n\nRefer to the [official VWO documentation](https://developers.vwo.com/v2/docs/fme-dotnet-install) for additional parameter details.\n\n---\n\n## User Context\n\nThe `VWOContext` object uniquely identifies users and supports targeting and segmentation. It includes parameters like user ID, custom variables, user agent, and IP address.\n\n### Parameters Table\n| **Parameter**         | **Description**                                                              | **Required** | **Type**             |\n|-----------------------|------------------------------------------------------------------------------|--------------|----------------------|\n| `Id`                  | Unique identifier for the user.                                              | Yes          | `string`             |\n| `CustomVariables`     | Custom attributes for targeting.                                             | No           | `Dictionary\u003cstring, object\u003e` |\n| `UserAgent`           | User agent string for identifying the user's browser and operating system.   | No           | `string`             |\n| `IpAddress`           | IP address of the user.                                                      | No           | `string`             |\n\n### Example\n```csharp\nvar context = new VWOContext\n{\n    Id = \"unique_user_id\",\n    CustomVariables = new Dictionary\u003cstring, object\u003e { { \"age\", 25 }, { \"location\", \"US\" } },\n    UserAgent = \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36\",\n    IpAddress = \"1.1.1.1\"\n};\n\n```\n\n---\n\n## Basic Feature Flagging\n\nFeature Flags serve as the foundation for all testing, personalization, and rollout rules within FME.\nTo implement a feature flag, first use the `getFlag` API to retrieve the flag configuration.\nThe `getFlag` API provides a simple way to check if a feature is enabled for a specific user and access its variables. It returns a feature flag object that contains methods for checking the feature's status and retrieving any associated variables.\n\n| Parameter    | Description                                                      | Required | Type   | Example              |\n| ------------ | ---------------------------------------------------------------- | -------- | ------ | -------------------- |\n| `featureKey` | Unique identifier of the feature flag                            | Yes      | String | `'new_checkout'`     |\n| `context`    | Object containing user identification and contextual information | Yes      | Object | `{ id: 'user_123' }` |\n\n\n### Example\n```csharp\nvar getFlag = vwoInstance.GetFlag(\"feature_key\", context);\n\nif (getFlag.IsEnabled())\n{\n    Console.WriteLine(\"Feature is enabled!\");\n\n    // Get and use feature variable\n    var variableValue = getFlag.GetVariable(\"feature_variable\", \"default_value\");\n    Console.WriteLine(\"Variable value: \" + variableValue);\n}\nelse\n{\n    Console.WriteLine(\"Feature is not enabled!\");\n}\n```\n\n---\n\n## Custom Event Tracking\n\nFeature flags can be enhanced with connected metrics to track key performance indicators (KPIs) for your features. These metrics help measure the effectiveness of your testing rules by comparing control versus variation performance, and evaluate the impact of personalization and rollout campaigns. Use the trackEvent API to track custom events like conversions, user interactions, and other important metrics:\n\n| Parameter         | Description                                                            | Required | Type   | Example                |\n| ----------------- | ---------------------------------------------------------------------- | -------- | ------ | ---------------------- |\n| `eventName`       | Name of the event you want to track                                    | Yes      | String | `'purchase_completed'` |\n| `context`         | Object containing user identification and other contextual information | Yes      | Object | `{ id: 'user_123' }`   |\n| `eventProperties` | Additional properties/metadata associated with the event               | No       | Object | `{ amount: 49.99 }`    |\n\n\n### Example\n```csharp\nvar eventProperties = new Dictionary\u003cstring, object\u003e { { \"revenue\", 100 } };\nvar trackResponse = vwoInstance.TrackEvent(\"event_name\", context, eventProperties);\nConsole.WriteLine(\"Event tracked: \" + trackResponse);\n```\n\nSee [Tracking Conversions](https://developers.vwo.com/v2/docs/fme-dotnet-metrics#usage) documentation for more information.\n\n### Pushing Attributes\n\nUser attributes provide rich contextual information about users, enabling powerful personalization. The `setAttribute` method provides a simple way to associate these attributes with users in VWO for advanced segmentation. Here's what you need to know about the method parameters:\n\n| Parameter        | Description                                                            | Required | Type   | Example                 |\n| ---------------- | ---------------------------------------------------------------------- | -------- | ------ | ----------------------- |\n| `attributeKey`   | The unique identifier/name of the attribute you want to set            | Yes      | String | `'plan_type'`           |\n| `attributeValue` | The value to be assigned to the attribute                              | Yes      | Any    | `'premium'`, `25`, etc. |\n| `context`        | Object containing user identification and other contextual information | Yes      | Object | `{ id: 'user_123' }`    |\n\nExample usage:\n```csharp\nvwoInstance.SetAttribute(\"attribute_key\", \"attribute_value\", context);\n\n```\n\nSee [Pushing Attributes](https://developers.vwo.com/v2/docs/fme-dotnet-attributes#usage) documentation for additional information.\n\n---\n\n### Polling Interval Adjustment\n\nThe `pollInterval` is an optional parameter that allows the SDK to automatically fetch and update settings from the VWO server at specified intervals. Setting this parameter ensures your application always uses the latest configuration.\n\n```csharp\nvar vwoClient = VWO.Init(new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    PollInterval = 60000 // Fetch updates every 60 seconds\n});\n```\n\n### Gateway\n\nThe VWO FME Gateway Service is an optional but powerful component that enhances VWO's Feature Management and Experimentation (FME) SDKs. It acts as a critical intermediary for pre-segmentation capabilities based on user location and user agent (UA). By deploying this service within your infrastructure, you benefit from minimal latency and strengthened security for all FME operations.\n\n#### Why Use a Gateway?\n\nThe Gateway Service is required in the following scenarios:\n\n- When using pre-segmentation features based on user location or user agent.\n- For applications requiring advanced targeting capabilities.\n- It's mandatory when using any thin-client SDK (e.g., Go).\n\n#### How to Use the Gateway\n\nThe gateway can be customized by passing the `gatewayService` parameter in the `init` configuration.\n\n```csharp\n\nvar vwoInitOptions = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    Logger = logger,\n    GatewayService = new Dictionary\u003cstring, object\u003e { { \"url\", \"https://custom.gateway.com\" } },\n};\n```\n\nRefer to the [Gateway Documentation](https://developers.vwo.com/v2/docs/gateway-service) for further details.\n\n### Retry Config\n\nThe `RetryConfig` parameter allows you to customize the retry behavior for network requests. This is particularly useful for applications that need to handle network failures gracefully with an exponential backoff strategy.\n\n| **Parameter**       | **Description**                                           | **Required** | **Type** | **Default** | **Validation**                      |\n| ------------------- | --------------------------------------------------------- | ------------ | -------- | ----------- | ----------------------------------- |\n| `shouldRetry`       | Whether to enable automatic retry on network failures     | No           | `bool`   | `true`      | Must be a boolean value             |\n| `maxRetries`        | Maximum number of retry attempts before giving up         | No           | `int`    | `3`         | Must be a non-negative integer \u003e= 1 |\n| `initialDelay`      | Initial delay (in seconds) before the first retry attempt | No           | `int`    | `2`         | Must be a non-negative integer \u003e= 1 |\n| `backoffMultiplier` | Multiplier for exponential backoff between retry attempts | No           | `int`    | `2`         | Must be a non-negative integer \u003e= 2 |\n\n#### How Retry Logic Works\n\nThe SDK implements an exponential backoff strategy for retrying failed network requests:\n\n1. **Initial Request**: The SDK attempts the initial network request.\n2. **On Failure**: If the request fails and `shouldRetry` is `true`, the SDK waits for `initialDelay` seconds.\n3. **Exponential Backoff**: For subsequent retries, the delay is calculated as: `initialDelay × (backoffMultiplier ^ attempt)`.\n4. **Maximum Attempts**: The SDK will retry up to `maxRetries` times before giving up.\n\n#### Example Usage\n\n```csharp\nusing VWOFmeSdk;\nusing VWOFmeSdk.Models.User;\n\nvar retryConfig = new Dictionary\u003cstring, object\u003e\n{\n    { \"shouldRetry\", true },   // Enable retries (default: true)\n    { \"maxRetries\", 5 },       // Retry up to 5 times\n    { \"initialDelay\", 3 },     // Wait 3 seconds before first retry\n    { \"backoffMultiplier\", 2 } // Double the delay for each subsequent retry\n};\n\nvar vwoInitOptions = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\", // Replace with your SDK key\n    AccountId = 123456,                  // Replace with your account ID\n    RetryConfig = retryConfig\n};\n\nvar vwoClient = VWO.Init(vwoInitOptions);\n```\n\n\n### Storage\n\nThe SDK operates in a stateless mode by default, meaning each `getFlag` call triggers a fresh evaluation of the flag against the current user context.\n\nTo optimize performance and maintain consistency, you can implement a custom storage mechanism by passing a `storage` parameter during initialization. This allows you to persist feature flag decisions in your preferred database system (like Redis, MongoDB, or any other data store).\n\nKey benefits of implementing storage:\n\n- Improved performance by caching decisions\n- Consistent user experience across sessions\n- Reduced load on your application\n\nThe storage mechanism ensures that once a decision is made for a user, it remains consistent even if campaign settings are modified in the VWO Application. This is particularly useful for maintaining a stable user experience during A/B tests and feature rollouts.\n\n### Example\n\n```csharp\nusing System;\nusing System.Collections.Generic;\nusing VWOFmeSdk.Packages.Storage;\n\npublic class StorageConnector : Connector\n{\n    public override object Get(string featureKey, string userId)\n    {\n        // Retrieve data based on featureKey and userId\n        return null;\n    }\n\n    public override void Set(Dictionary\u003cstring, object\u003e data)\n    {\n        // Store data based on data[\"featureKey\"] and data[\"userId\"]\n    }\n}\n\nvar vwoInitOptions = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    Storage = new StorageConnector()\n};\n\n```\n\n---\n\n### Logger\n\nVWO by default logs all `ERROR` level messages to your server console.\nTo gain more control over VWO's logging behaviour, you can use the `logger` parameter in the `init` configuration.\n\n| **Parameter** | **Description**                        | **Required** | **Type** | **Example**           |\n| ------------- | -------------------------------------- | ------------ | -------- | --------------------- |\n| `level`       | Log level to control verbosity of logs | Yes          | String   | `DEBUG`               |\n| `prefix`      | Custom prefix for log messages         | No           | String   | `'CUSTOM LOG PREFIX'` |\n| `transport`   | Custom logger implementation           | No           | Object   | See example below     |\n\n\n#### Example 1: Set log level to control verbosity of logs\n\n```csharp\nvar vwoInitOptions1 = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    Logger = new Logger\n    {\n        Level = \"DEBUG\"\n    }\n};\nvar vwoClient1 = VWO.Init(vwoInitOptions1);\n```\n\n#### Example 2: Add custom prefix to log messages for easier identification\n\n```csharp\nvar vwoInitOptions2 = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    Logger = new Logger\n    {\n        Level = \"DEBUG\",\n        Prefix = \"CUSTOM LOG PREFIX\"\n    }\n};\nvar vwoClient2 = VWO.Init(vwoInitOptions2);\n```\n\n#### Example 3: Implement custom transport to handle logs your way\n\nThe `transport` parameter allows you to implement custom logging behavior by providing your own logging functions. You can define handlers for different log levels (`debug`, `info`, `warn`, `error`, `trace`) to process log messages according to your needs.\n\nFor example, you could:\n\n- Send logs to a third-party logging service\n- Write logs to a file\n- Format log messages differently\n- Filter or transform log messages\n- Route different log levels to different destinations\n\nThe transport object should implement handlers for the log levels you want to customize. Each handler receives the log message as a parameter.\n\n```csharp\n\nvar vwoInitOptions3 = new VWOInitOptions\n{\n    SdkKey = \"32-alpha-numeric-sdk-key\",\n    AccountId = 123456,\n    Logger = new Logger\n    {\n        Level = \"DEBUG\",\n        Transports = new List\u003cLogTransport\u003e\n        {\n            new LogTransport\n            {\n                Level = \"DEBUG\",\n                LogHandler = (msg, level) =\u003e Console.WriteLine($\"DEBUG: {msg}\")\n            },\n            new LogTransport\n            {\n                Level = \"INFO\",\n                LogHandler = (msg, level) =\u003e Console.WriteLine($\"INFO: {msg}\")\n            },\n            new LogTransport\n            {\n                Level = \"ERROR\",\n                LogHandler = (msg, level) =\u003e Console.WriteLine($\"ERROR: {msg}\")\n            }\n        }\n    }\n};\nvar vwoClient3 = VWO.Init(vwoInitOptions3);\n\n```\n---\n\n### Version History\n\nThe version history tracks changes, improvements, and bug fixes in each version. For a full history, see the [CHANGELOG.md](https://github.com/wingify/vwo-fme-dotnet-sdk/blob/master/CHANGELOG.md).\n\n## Development and Testing\n\n### Install Dependencies and Bootstrap Git Hooks\n\n```bash\ndotnet restore\n```\n\n### Compile Solution\n\n```bash\ndotnet build\n```\n\n### Run Tests\n\n```bash\ndotnet test\n```\n\n## Contributing\n\nWe welcome contributions! Please read our [contributing guidelines](https://github.com/wingify/vwo-fme-dotnet-sdk/CONTRIBUTING.md) before submitting a PR.\n\n---\n\n## License\n\n[Apache License, Version 2.0](https://github.com/wingify/vwo-fme-dotnet-sdk/blob/master/LICENSE)\n\nCopyright 2024-2025 Wingify Software Pvt. Ltd.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingify%2Fvwo-fme-dotnet-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwingify%2Fvwo-fme-dotnet-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingify%2Fvwo-fme-dotnet-sdk/lists"}