# Quick-start

## Installation

Refer to the [installation page](/server-side/sdks/net/net-installation.md) for installation steps.

## Flagship Usage

### Start SDK

**Step 1:** Start the SDK by calling the [start](/server-side/sdks/net/net-reference.md#start-method) method of the [Fs](/server-side/sdks/net/net-reference.md#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](/server-side/concepts/decision-mode.md). More options are available in the [SDK configuration](/server-side/sdks/net/net-reference.md#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](/server-side/sdks/net/net-reference.md#visitor-property) using the [newVisitor](/server-side/sdks/net/net-reference.md#newvisitor-method) method from the [Fs](/server-side/sdks/net/net-reference.md#start-method) instance. The visitor instance allows you to set relevant data for Flagship to make a decision, including: [Visitor ID](/server-side/glossary.md#visitor-id), [Visitor Context](/server-side/glossary.md#user-context), [GDPR Consent](/server-side/sdks/net/net-reference.md#newvisitor-method), and [Authentication status](/server-side/sdks/net/net-reference.md#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](/server-side/sdks/net/net-reference.md#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](/server-side/sdks/net/net-reference.md#getflag-method) method of the [**visitor instance**](/server-side/sdks/net/net-reference.md#visitor-property) to retrieve a specific [flag](/server-side/sdks/net/net-reference.md#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](/server-side/sdks/net/net-reference.md#getvalue-method).
  {% endhint %}

\\

### Tracking hits

**Step 6:** Send hits to Flagship using the [sendHit](/server-side/sdks/net/net-reference.md#sendhit-method) method of the [**visitor instance**](/server-side/sdks/php/php-reference.md). 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"));
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/server-side/sdks/net/net-quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
