.NET
Get started with SDK integration quickly through a few steps.
Step 1. Install SDK
Step 2. Initialize SDK
Step 3. A/B Test, Feature Flag
Step 4. Track User Events
Step 1. Install SDK
Add the SDK dependency.
Install-Package HackleStep 2. Initialize SDK
HackleClient is the class that provides methods for using the SDK's features. To use the SDK, you need to initialize HackleClient.
Instantiation
Pass the SDK Key to instantiate HackleClient.
HackleClient periodically synchronizes with the Hackle server as a background task to obtain the necessary information.
var hackleClient = HackleClients.Create("YOUR_SERVER_SDK_KEY")❗️ HackleClient must be a singleton.
HackleClientmanages state internally to distribute variations without blocking the calling thread. This requires additional resources. Instead of instantiating a new client for every request, it must be managed as a single instance throughout the application lifecycle.
Step 3. A/B Test, Feature Flag
A/B Test
When running an A/B Test, you need to distribute users into variations and implement logic for each variation. You can use the Hackle SDK to handle user distribution.
📘 Variation
A variation refers to the current baseline version (Control) and improved versions (Treatment) being tested, with one or more Treatment groups possible. You can configure this on the Dashboard. Refer to the [A/B Test Settings](../A:B 테스트/manage-ab-dashboard/ab-settings.md) document for how to manage variations.
variation
Pass the Experiment Key to the Variation() method to distribute the user and receive the result. Then implement logic per variation.
The Experiment Key is a unique number assigned to each A/B test and can be found in the Hackle Dashboard.
The example code below passes experiment key 42, with two variations: A and B.
Feature Flag
A Feature Flag has an on state and an off state. Different features are configured for each state. When a user accesses a feature with a Feature Flag applied, they should receive either an on or off state. You can use the Hackle SDK to determine this state.
isFeatureOn
Pass the Feature Key to the IsFeatureOn() method to receive the state result for the user. Then implement logic based on the state.
The Feature Key is a unique number assigned to each Feature Flag and can be found in the Hackle Dashboard.
The example code below passes feature key 42.
Verifying Distribution Results
In the Hackle Dashboard, navigate to the A/B test or Feature Flag from the left menu, find the integrated item in the list, go to the detail page, and click the Real-time Exposure Status tab in the middle of the screen to view the distribution results from the SDK integration.

Step 4. Track User Events
The Hackle SDK provides the ability to send user events to Hackle. By using this feature at every point where a change in user behavior occurs, you can obtain meaningful data about user behavior and analyze it.
track
Pass the Event Key to the Track() method to track user events. If needed, you can include a numeric value in value when tracking a user event.
valueonly accepts the number type.
Example 1
Suppose you defined the event key purchase to collect events when a user clicks the purchase button. You may also want to collect the purchase amount. In this case, you can include the purchase amount in value.
Example 1 shows sending only the event key, while Example 2 shows including the purchase amount in value to collect it along with the event.
Property
The Hackle SDK supports adding properties to Event objects.
Properties must be sent as key-value pairs.
A maximum of 64 properties can be added to an event object.
Property Key
Create keys like regular variable names, but make them easy to identify.
Character limit is 64 characters.
Case-insensitive. For example,
amountandAMOUNTare recognized as the same key.
Property Value
value supports boolean, string, and number types.
For string type, the character limit is 64 characters.
For number type, up to 15 integer digits and up to 6 decimal places are supported.
Example
The example below shows three properties (pay_method, discount_amount, is_discount) being added.
Verifying User Event Tracking
Check whether user events sent from the SDK are being collected correctly. You can find the event sent via the SDK in the Event Management menu in the left sidebar of the Hackle Dashboard and check the real-time event collection status.

Last updated