> 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](https://docs.abtasty.com/server-side/glossary.md#visitor-id) , [Visitor Context](https://docs.abtasty.com/server-side/glossary.md#user-context-1) , [GDPR Consent](https://docs.abtasty.com/server-side/sdks/key-features/managing-visitor-consent.md) , and [Authenticated](https://docs.abtasty.com/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](https://docs.abtasty.com/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](https://docs.abtasty.com/server-side/sdks/js-sdk/js-reference.md#newvisitor-method)   |
| [React-JS](https://docs.abtasty.com/server-side/sdks/react/react-js-reference.md#flagshipprovider) |
| [React-Native](https://docs.abtasty.com/server-side/sdks/net/net-reference.md#newvisitor-method)   |
| [PHP](https://docs.abtasty.com/server-side/sdks/php/php-reference.md#newvisitor-method)            |
| [.NET](https://docs.abtasty.com/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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
