> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/server-side/sdks/key-features/creating-a-visitor.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.abtasty.com/server-side/sdks/key-features/creating-a-visitor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
