# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eraya.gitbook.io/eraya-docs/eraya-analytics-specification/visitor-classification.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
