# UX & Browser Control

These steps are designed to control the **user’s experience directly** — whether that means navigating between pages, triggering downloads, injecting JS, or throwing custom events inside your frontend. Together, they let you seamlessly blend logic with UI behavior.

### **Go to URL**

**Purpose:**

Redirects the user to another page — either internal (within the app) or external.

**Key Options:**

* **Internal Link**: Dropdown of your app’s defined pages
* **Custom URL**: External or dynamically built URL (can use `{parameters_}` or `{var_}` references)
* **Parameters**: Add query parameters to internal links
* **Open in New Tab**: Optional checkbox for opening internal or external links in a new tab.

**When to Use:**

* Redirect user after form submission or login
* Navigate based on user selection or logic (e.g., "Go to dashboard if logged in")
* Link into third-party tools or portals

***

### **Execute JavaScript**

**Purpose:**

Runs a block of custom JavaScript in the user’s browser.

**Key Options:**

* **Code Editor**: Paste your JS snippet
* **Timeout (ms)**: Execution timeout (prevents runaway scripts)

**When to Use:**

* Extend the possibilities of Ondeva with custom code that consumes variables and data collected via Ondeva.
* Modify client-side DOM manually
* Call browser APIs (clipboard, localStorage, etc.)

**Best Practices:**

* Keep scripts short and well-scoped. Don’t overload the client with unnecessary scripts.
* Use `try/catch` inside your script if needed
* Use the data provided by the `individee.meta` object safely. You have access to the variables and parameters `individee.meta.parameters` as well as to loaded queries `individee.meta.tables` .

***

### **Trigger Download**

**Purpose:**

Initiates a file or visual component download for the user.

**Modes Supported:**

* **Chart Snapshot**: Download an image of a chart component on the current page. Pass the markup id of the chart component.
* **Map Snapshot**: Download an image of a map on the current page. Pass the markup id of the map component.
* **File Field of Table Entry**: Downloads a file stored in a specific field in a table
* **Generated Document**: PDF or spreadsheet generated by Ondeva’s document engine

**Key Options:**

* **Component or Table Reference**: Depending on the mode
* **Filename**: Set static or dynamic file names

**When to Use:**

* Export reports or dashboards
* Let users download file attachments (e.g., invoices, submissions)
* Offer dynamic content based on data or session state

***

### **Throw Event**

**Purpose:**

Fires a custom event into Ondeva’s event system — useful for analytics, real-time responses, or syncing across components.

**Key Options:**

* **Event Name**: Unique identifier (e.g., `user_registered`, `plan_upgraded`)
* **Persist Event**: When checked, the event is stored for analysis in the performance area
* **Metadata**: Optional values like session ID, user ID, or URL context

**When to Use:**

* Custom instrumentation (track clicks, conversions, form usage)
* Fire off workflows based on frontend actions (when listening via another workflow)
* Log milestones for performance dashboards

***

### Best Practices

* **Use named events** consistently to track workflows (e.g., `invoice_paid`, `support_request_opened`)
* Always set a fallback for **Go to URL** when depending on variables (avoid broken redirects)
* Leverage **download triggers** for user-facing confirmations or exports, especially in enterprise tools
