# Quick-start

## Installation

Refer to the [installation page](https://docs.abtasty.com/server-side/sdks/net/net-installation) for installation steps.

## Flagship Usage

### Start SDK

**Step 1:** Start the SDK by calling the [start](https://docs.abtasty.com/server-side/sdks/net-reference#start-method) method of the [Fs](https://docs.abtasty.com/server-side/sdks/net-reference#fs-class) class, in the most appropriate location for your application.

```csharp
using Flagship.Main;

// Step 1: start the SDK
Fs.Start("<ENV_ID>", "<API_KEY>");
```

This starts the SDK in [DECISION-API](https://docs.abtasty.com/server-side/concepts/decision-mode). More options are available in the [SDK configuration](https://docs.abtasty.com/server-side/sdks/net-reference#configuration-options).

{% hint style="info" %}
👍 Good to know

Your **apiKey** and **environmentId** can be found in your Flagship account under Parameters > Environment & Security.
{% endhint %}

### Create a visitor

**Step 2:** Create a [visitor](https://docs.abtasty.com/server-side/sdks/net-reference#visitor-property) using the [newVisitor](https://docs.abtasty.com/server-side/sdks/net-reference#newvisitor-method) method from the [Fs](https://docs.abtasty.com/server-side/sdks/net-reference#start-method) instance. The visitor instance allows you to set relevant data for Flagship to make a decision, including: [Visitor ID](https://docs.abtasty.com/server-side/glossary#visitor-id), [Visitor Context](https://docs.abtasty.com/server-side/glossary#user-context), [GDPR Consent](https://docs.abtasty.com/server-side/sdks/net-reference#newvisitor-method), and [Authentication status](https://docs.abtasty.com/server-side/sdks/net-reference#newvisitor-method).

For example, if you want to enable a specific feature for all your `VIP` visitors, you'll need to add this data as an attribute into the visitor context (key-value pair): `isVIP: true`. Based on your targeting criteria defined in your use-case (`isVIP === true`), Flagship will make the decision and show your feature to visitors that have `isVIP` in their context and for which `isVIP` is equal to `true`.

```csharp
using Flagship.Main;

//Step 2: Create a visitor
var visitor = Fs.NewVisitor("<VISITOR_ID>", true)
  .SetContext(new Dictionary<string, object>(){["isVip"] = true})
  .Build();
```

### Getting Flags

**Steps 3, 4, and 5** involve **fetching flags from Flagship**, **retrieving your flag**, and **reading your flag's value.**

First, fetch flags from the [Flagship platform](https://app.flagship.io/login) using the [fetchFlags](https://docs.abtasty.com/server-side/sdks/net-reference#fetchflags-method) method. You can ensure that your flags are fetched and ready to be used by using an `await` statement, a `then` function, or an `event listener`.

Then, use the [getFlag](https://docs.abtasty.com/server-side/sdks/net-reference#getflag-method) method of the [**visitor instance**](https://docs.abtasty.com/server-side/sdks/net-reference#visitor-property) to retrieve a specific [flag](https://docs.abtasty.com/server-side/sdks/net-reference#iflag-interface) object based on the key provided. This object includes methods to retrieve the flag value, access flag metadata, expose the flag, verify the flag's existence, and get the flag status.

```csharp

//Step 3: Fetch flag from the Flagship platform 
await visitor.FetchFlags();

/* Step 4: Retrieves a flag named "displayVipFeature", 
 */
var flag = visitor.GetFlag("displayVipFeature");

//Step 5: get the flag value and if the flag does not exist, it returns the default value "false"
var flagValue = flag.GetValue(false);

Console.WriteLine($"Flag {flagValue}");

```

{% hint style="info" %}
👍 Good to know

* By default, the SDK assumes that the visitor has been exposed to the flag when `flag.GetValue` is called, so it sends the flag exposure hit to flagship server. However, this behavior can be changed. [Click here for more details](https://docs.abtasty.com/server-side/sdks/net-reference#getvalue-method).
  {% endhint %}

\\

### Tracking hits

**Step 6:** Send hits to Flagship using the [sendHit](https://docs.abtasty.com/server-side/sdks/net-reference#sendhit-method) method of the [**visitor instance**](https://docs.abtasty.com/server-side/sdks/php/php-reference). These hits help validate your objectives (KPIs) set up in your campaign.

```jsx
// ... other code

await visitor.SendHit(new Event(EventCategory.ACTION_TRACKING, "add-to-cart"));
```
