> For the complete documentation index, see [llms.txt](https://docs.ondeva.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ondeva.com/workflow/steps-reference/user-flow-and-e-commerce.md).

# User Flow & E-Commerce

Ondeva gives you precise control over user access, session behavior, and monetization flows. These steps are essential for any SaaS or productized app built on Ondeva — enabling authentication, license enforcement, and seamless e-commerce actions from within workflows.

### **Login**

**Purpose:**

Forces the user to authenticate. If already logged out, they’ll be redirected to the login page and returned to their current screen upon success.

**When to Use:**

* Guard protected content
* Require login before form submission
* Secure workflows that write to user-specific data

***

### **License Enforcing**

**Purpose:**

Checks whether the user has a valid license (or set of licenses). If the check fails, the user is blocked from progressing.

**Key Options:**

* **License Selection**: Choose one or more required licenses

**When to Use:**

* Gate workflows or features based on paid plan
* Handle upsells for premium components
* Limit access to internal tools or downloads

***

### **Add Item to Cart (E-Commerce)**

**Purpose:**

Adds a product or license to the current user’s shopping cart.

**Key Options:**

* **Product / License**: Select the item to be added
* **Clear Cart First**: Optional — clears the current cart before adding the new item

**When to Use:**

* Trigger a checkout flow (e.g. “Buy Now” button)
* Offer upgrade paths (add license for additional features)
* Support dynamic pricing tiers or modular subscriptions

***

### **Register Session**

**Purpose:**

Logs a session-level tracking entry with optional metadata for analysis. The Session ID is stored in a variable: `{var_sessionId}`

**Key Options:**

* **User ID** (optional)
* **Session ID** (optional)
* **URL** (context page)

**When to Use:**

* Record usage sessions for metrics
* Tie workflows to performance data
* Build your own internal analytics pipeline

***

### **Register Page View**

**Purpose:**

Tracks a page visit for the current session and user. The Visit ID is stored in a variable: `{var_visitId}`

**Fields:**

* **User ID** (optional)
* **Session ID** (optional)
* **URL** (context page)

**When to Use:**

* Funnel tracking
* Custom conversion attribution
* Heatmap or flow visualization features

***

### Best Practices

* Combine **License Enforcing** with **Design Visibility** rules for a seamless UX.
* Use **Add to Cart** in pricing tables, modals, or gated content dialogs.
* Log sessions and page views if you want to collect analytics event from other sources then the automatic tracking of Ondeva’s analytics system.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ondeva.com/workflow/steps-reference/user-flow-and-e-commerce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
