About Handling Visitors

Visitor tokens enable your headless site or app to maintain anonymous visitor sessions without requiring visitors to log in. These tokens authenticate API calls made on behalf of anonymous visitors, allowing you to track visitor-specific data like shopping cart contents and preferences across page visits.

Without visitor tokens, each API call is treated as coming from a new visitor, meaning shopping cart items and other visitor data disappears between page refreshes.

Handling visitors with the CLI

In Wix-managed headless projects, you don't need to handle visitor tokens manually. The CLI automatically generates and manages visitor tokens for you.

When you call APIs, the CLI handles authentication automatically by creating a client with the appropriate visitor tokens.

Handling visitors in self-managed headless projects

In self-managed headless projects, you need to handle visitor tokens manually. You can generate and manage visitor tokens using the JavaScript SDK or the REST API.

To handle visitors in a self-managed headless project, you first need to create an OAuth app for visitors and members. If you're using the Wix SDK, you'll also need to create a client with OAuth.

See also

Did this help?