Source: https://datafa.st/docs/cli-visitors
Markdown source: https://datafa.st/docs/cli-visitors.md
Description: Retrieve identity, activity, goals, and prediction data for a unique visitor using the DataFast CLI.

# CLI — Visitors

Get details for a unique visitor from the terminal. Works with both `dft_` account tokens and `df_` website API keys.

The visitors commands map to [List visitors](/docs/api-list-visitors) and [Get visitor data](/docs/api-get-visitor):

```txt
GET /api/v1/visitors
GET /api/v1/visitors/{datafast_visitor_id}
```

## Search visitors

```sh
# People who visited /pricing in the last 30 days
datafast visitors list --visited-page /pricing --period last30d

# People who read docs and completed signup
datafast visitors list --visited-page-contains /docs --completed-goal signup --period last30d

# Mobile visitors from Google in France
datafast visitors list --device mobile --referrer Google --country France --period last30d

# Customers from a launch campaign
datafast visitors list --utm-campaign launch --is-customer --period last30d
```

## Get visitor details

```sh
datafast visitors get <datafast_visitor_id>
datafast visitors get <datafast_visitor_id> --website <websiteId>
```

With a `dft_` account token, omit `--website` to choose from your websites interactively. With a `df_` website API key, the website is already scoped.

The response includes:

- Visitor identity data such as country, browser, OS, device, URL params, and ad click IDs
- Visitor activity such as first visit, last visit, visit count, page views, visited pages, and completed custom goals
- Identify profile data such as `profile.userId`, `profile.metadata`, and `profile.identifiedAt` when available. See [user identification](/docs/user-identification) to connect anonymous visitors to your users.
- Prediction data when conversion metrics are available

## Visitor drilldown use cases

```sh
# "Show me who visited /pricing in the last 30 days"
datafast visitors list --visited-page /pricing --period last30d

# "Show me who read docs and then signed up"
datafast visitors list --visited-page-contains /docs --completed-goal signup --period last30d

# "Show me customers from a launch campaign"
datafast visitors list --utm-campaign launch --is-customer --period last30d

# "Show me who churned today"
datafast visitors list --completed-goal subscription_ended --period today

# Then fetch full identity, activity, profile, and prediction data
datafast visitors get <datafast_visitor_id>
```

Payment-provider goals such as `payment`, `free_trial`, and `subscription_ended` are tracked automatically when you connect a payment provider. See [custom goals](/docs/custom-goals#automatic-payment-provider-goals) for the full reserved list.

> When you set up [revenue attribution](/docs/revenue-attribution-guide) with a [payment provider](/docs/connect-payment-provider), DataFast can map SaaS lifecycle events back to visitors. This lets you ask questions like "who started a trial today?", "who subscribed?", or "who churned today?", then use [Identify](/docs/user-identification) data from `visitors get` to see the user ID, email, name, or other profile metadata.

Use `--json` for compact output:

```sh
datafast --json visitors get <datafast_visitor_id>
```
