> For the complete documentation index, see [llms.txt](https://eraya.gitbook.io/eraya-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eraya.gitbook.io/eraya-docs/eraya-analytics-specification/visitor-classification.md).

# Visitor Classification

### Overview

Eraya automatically classifies each visitor as **New** or **Returning** to help distinguish between first-time and repeat interactions.\
This classification is essential for accurate funnel metrics, conversion analysis, and A/B test segmentation.

### How Eraya Tags Visitors

Eraya uses a **persistent client-side visitor identifier (`eraya_userId`)** stored in the browser when the visitor first lands on the store.\
This ID remains consistent across sessions unless cookies or local storage are cleared.

**Mechanism**

1. On initial page load, Eraya checks for an existing `eraya_userId` in:
   * `localStorage`
   * (and optionally) a first-party cookie.
2. If no ID exists, Eraya generates a new unique ID (UUID v4) and assigns:
   * `visitor_type = "new"`
3. For all subsequent visits using the same ID:
   * `visitor_type = "returning"`

This logic aligns with Shopify’s session tracking model — visitors remain **new** for their first 30–60 minutes of activity and **returning** afterward if they revisit or continue browsing later.
