# Creating a Visitor

Within the `Flagship SDK`, a visitor represents an individual user of your application. Each visitor is identified by a unique ID, which allows Flagship to track their interactions and deliver personalized experiences based on their context.

By creating a visitor instance, you will be able to set all relevant data for Flagship to take a Decision. These data include : [Visitor ID](/server-side/glossary.md#visitor-id) , [Visitor Context](/server-side/glossary.md#user-context-1) , [GDPR Consent](/server-side/sdks/key-features/managing-visitor-consent.md) , and [Authenticated](/server-side/sdks/key-features/updating-the-visitor-context.md) or not.

Below are examples in different programming environments:

{% tabs %}
{% tab title="TypeScript" %}

```typescript
// ...import code 

Flagship.start("<ENV_ID>", "<API_KEY>");

const fsVisitor = Flagship.newVisitor({
  visitorId: "<VISITOR_ID>",
  hasConsented: true, 
  context: {
    isVIP: true,
    country: "NL",
    loginProvider: "Google"
  }
});
```

{% endtab %}

{% tab title="React" %}

```jsx
import React from "react";
import { FlagshipProvider } from "@flagship.io/react-sdk";

const App = () => (
  <>
    <FlagshipProvider
      envId="<ENV_ID>"
      apiKey="<API_KEY>"
      visitorData={{
        id: "<VISITOR_ID>",
        hasConsented: true, // This is required
          context: {
            isVIP: true,
            country: "NL",
            loginProvider: "Google"
          }
      }}
    >
      {/* ... */}
    </FlagshipProvider>
  </>
);
```

{% endtab %}

{% tab title="React Native" %}

```jsx
import React from "react";
import { FlagshipProvider } from "@flagship.io/react-native-sdk";

const App = () => (
  <>
    <FlagshipProvider
      envId="<ENV_ID>"
      apiKey="<API_KEY>"
      visitorData={{
        id: "<VISITOR_ID>",
        hasConsented: true, // This is required
          context: {
            isVIP: true,
            country: "NL",
            loginProvider: "Google"
          }
      }}
    >
      {/* ... */}
    </FlagshipProvider>
  </>
);
```

{% endtab %}

{% tab title="PHP" %}

```php
require __DIR__ . '/vendor/autoload.php';

use Flagship\Flagship;
 
// ...other code 

$visitor = Flagship::newVisitor("<VISITOR_ID>", true)
  ->setContext([
    	"isVip" => true,
    	"country": "NL",
    	"loginProvider": "Google"
  ])->build();
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using Flagship.Main;

// ...other code 

var visitor = Fs.NewVisitor("<VISITOR_ID>", true)
  .SetContext(new Dictionary<string, object> {
    { "isQA", true },
    { "country", "NL" },
    { "loginProvider", "Google" }
  })
  .Build();

// ...other code 
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
📘 Information

You should make sure that you have already [started](/server-side/sdks/key-features/starting-and-configuring-the-sdk.md) the sdk before creating any visitor.
{% endhint %}

Please consult the reference documentation of `newVisitor` for your specific SDK for more detailed information:

| SDK                                                                        |
| -------------------------------------------------------------------------- |
| [Javascript](/server-side/sdks/js-sdk/js-reference.md#newvisitor-method)   |
| [React-JS](/server-side/sdks/react/react-js-reference.md#flagshipprovider) |
| [React-Native](/server-side/sdks/net/net-reference.md#newvisitor-method)   |
| [PHP](/server-side/sdks/php/php-reference.md#newvisitor-method)            |
| [.NET](/server-side/sdks/net/net-reference.md#newvisitor-method)           |


---

# 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/key-features/creating-a-visitor.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.
