> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RUM analytics

> Count the sessions that got through a series of pages and actions, follow the pages sessions went through, and see how many people come back.

**RUM → Analytics** asks what people do across a session. It is of one application at a time, in one environment or in all of
them, over the time range in view, which is the last 7 days when the page opens without one. It has three views: **Funnel**,
**Paths**, and **Retention**. Each works for browser applications and for apps; where the words differ, an app says screen for
page.

Everything a view asks is in the address, so a question is a link that can be shared.

## Funnel

A funnel counts the sessions that did a series of steps in order. It answers where people drop out of a flow, such as a
checkout.

### Steps

A funnel has 2 to 8 steps. **Add a step** adds one, and the cross at the end of a step removes it. A step is one of two kinds:

| Kind | What it is | Fields it can look in |
| - | - | - |
| **Page** (**Screen** in an app) | A page or screen that was opened. | **Page group** (`view.url_path_group`, the path with the parts that change, such as an id, grouped), **Exact path** (`view.url_path`), **View name** (`view.name`). A page of a browser begins with the page group, and a screen of an app with the view name. |
| **Action** | Something a person did: a click, a tap, a custom action. | **Target name** (`action.target.name`), **Target selector** (`action.target.selector`), **Type** (`action.type`). |

Each step looks for a value in its field. The value is chosen from the commonest ones the data has in the time range, or
typed. **is** matches the whole value, and a `*` in it stands for any text. **contains** matches any value that holds the
text, whatever its case.

### How a session is counted

A session counts for the first step by the first row that meets it. It counts for each step after that by the first row that
meets the step later than the row of the step before, in the same session. Other pages and actions between two steps do not
matter: a session that opened five other pages between the cart and the checkout still got through.

* **Time limit** counts a session for a step only when the step came within that time from the first step: 5 minutes, 30
  minutes, 1 hour, or 1 day. **No time limit** counts a session however long it took.
* **Count sessions by** gives a funnel for each value of a field of the row that counted the session for the first step:
  the browser, the system, the device type, the version, or the country. The 10 values with the most sessions are kept.
  **All sessions together** gives one.

### What it says

A row for each step, with a bar as long as its share of the first step's sessions:

| Column | Meaning |
| - | - |
| **Sessions** | The sessions that got through the step. |
| **Of the first** | The share of the sessions of the first step. |
| **Drop-off** | The share of the sessions of the step before that did not get here. A loss of more than half is in red. |
| **Median time** | The middle of the times between the step before and this step. |

A funnel counted by a field adds a table: a row for each value, with the sessions of every step, the share of the sessions
of the step before beside each, and **First to last**, the share of the sessions of the first step that got through every step.

A funnel whose first step nobody did says so, and offers to expand the time range. The steps, the time limit, and the field
are the `steps`, `win`, and `by` of the address. A step is written as `v:` for a page or `a:` for an action, its field, `=` or
`~` for contains, and its URL-encoded value; steps are joined with `|`.

## Paths

Paths follow the pages sessions opened, as columns of the pages with the most sessions, with a ribbon between two pages as
thick as the sessions that went from one to the other.

* **After the page** follows what sessions opened next, and **Before the page** what they opened before. Without a page,
  the paths start at the first page of each session, and going back they end at the last one.
* The page is chosen from the commonest pages the data has, or typed, and **Clear** puts it away. Clicking a page of the
  chart starts the paths from it.
* **How many pages** is from 1 to 6 pages after (or before) the page; the default is 3.
* **Pages are told by** is the page group, the exact path, or the view name (in a browser application).

A page is as tall as the sessions that were on it. A column names the 8 pages with the most sessions and puts the rest together
as **Other pages**. A page opened again at once, such as a reload, counts once. A page the paths are of is the first column,
or going back the last; a column nobody got to is not drawn. A tooltip says how many sessions went no further from a page (or
began there, going back).

The page, the direction, the number of pages, and the field are the `anchor`, `dir` (`before`), `depth`, and `page` of the
address.

## Retention

Retention counts who came back. The people first seen in a day or in a week of the time range are a cohort, and each cell says
what share of the cohort was seen again that many periods later.

* The first choice is **Day** or **Week**. Periods are days of UTC and weeks of UTC that begin on Monday, so a cohort is named
  by the date it begins on, whatever the time zone of the reader.
* The second choice is how many periods to follow: **7 days after**, **14 days after**, or **30 days after**, and in weeks
  for cohorts by week.
* A person is the user id of the session, or for a visitor who has none the anonymous id the SDK keeps on the device.
* A person is first seen in the time range, so the range is the history that is looked at. A person who came before it is
  taken for a new one on the first day they are seen in it.
* A period that has not ended by the end of the time range says nothing, and its cell has a dash.
* **Average** takes the share of all the people of the cohorts that could say, so a big cohort weighs more than a small one.

The period and the number of periods are the `period` and `periods` of the address.

## How the numbers are counted

Each view is counted by one statement over the views, the sessions and the actions, run by the engine that answers the rest of
RUM. A view is written again each time its numbers change, and what a person is asked of a view is asked of the newest of
these. A step that asks only what every revision of a view says alike, such as the page, the application, the environment, the
release or the browser, reads the views as they were written, which spares the work of choosing the newest of each; a step that
asks for the numbers of a view (its errors, its vitals) or who the person was takes the newest. What the engine masks for the
reader stays masked, and a count that takes longer than the time budget says so while the page stays: narrow the time range and
ask again. The same questions are asked of the API with [`/api/v1/rum/analytics`](https://docs.molesignal.com/en-US/api/rum#funnels-paths-and-retention).

For a sense of size: on one node with 10 CPU cores and 1 million sessions (18 million events) in the range, a funnel of four
pages answered in about 2 seconds, a funnel of eight pages in about 5, the paths in about 6 and retention in about 1.5. The cost
grows with the sessions in the range and, for a funnel, with its steps.

When the application [keeps only a share of its sessions](https://docs.molesignal.com/en-US/rum/sampling.md), a funnel and the paths count each session for as
many as the share it was kept with says, so they are the counts of every session, and the page says **Estimated**. Retention
counts the people seen in the sessions that were kept: with sampling its cohorts hold only the people of those sessions, and people
who visit often are the likelier to be among them.

The page needs the permission that reads the rest of RUM, `streams.query`. See [RUM](https://docs.molesignal.com/en-US/rum#permissions).

## Mole Agent

Mole Agent asks the same questions with `get_rum_funnel`, `get_rum_paths`, and `get_rum_retention`. The built-in skill
`/rum-triage` uses them when a problem is a flow, and cites the funnel or the paths as a link to this page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.