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 , Visitor Context , GDPR Consent , and Authenticated or not.
Below are examples in different programming environments:
// ...import code
Flagship.start("<ENV_ID>", "<API_KEY>");
const fsVisitor = Flagship.newVisitor({
visitorId: "<VISITOR_ID>",
hasConsented: true,
context: {
isVIP: true,
country: "NL",
loginProvider: "Google"
}
});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>
</>
);Please consult the reference documentation of newVisitor for your specific SDK for more detailed information:
Last updated
Was this helpful?

