# Analytics kipitiny can count visits of your apps' domains: pageviews, visitors, where they come from and what they use, without cookies or a consent banner. A small analytics server runs next to Traefik on the manager's server and keeps the data in its own volume; nothing goes to a third party, and the manager itself stores none of it. ## Turning it on 1. In **Settings › Analytics**, click **Enable analytics** and give it a **domain**, e.g. `stats.example.com`. It serves the tracker script and receives the visits, over HTTPS like an app. Point its DNS at the server (with [Cloudflare connected](/docs/domains) the record is created for you). The dialog lists what happens; **Enable** runs it step by step. 2. In an app's **Settings › Networking**, turn on **Analytics** (or set `analytics: true` in its [`x-kipitiny`](/docs/compose#x-kipitiny-per-service) block). The app needs a domain and a container port. Applies right away, no deploy. 3. Add the script to the app's pages, e.g. in the `
`: ```html ``` The app's **Analytics** tab shows the numbers, and the exact tag to copy. ### Ad blockers Some ad blockers drop scripts and requests to known analytics paths. In the app's **Settings › Networking › Analytics**, **Tracker paths** gives the app two paths of its own domain instead, e.g. `/js/app.js` for the script and `/api/collect` for the visits. Traefik then sends those two paths of the app's domain to the analytics server (above the app's own routes, so pick paths the app doesn't use), and the tag becomes: ```html ``` It applies right away, without a deploy; the analytics server restarts in a second to take the new routes. The analytics domain's `/a.js` and `/e` keep working, so pages still on the old tag count until you change it. **Use the defaults** removes the paths. Paths are letters, digits and `. _ ~ - /`, up to 100 characters, and differ from each other. Not settable from a compose file for now, so not for apps of a git-linked project. The server runs from the manager's own image, so there's nothing to pull: a container of a few MB of memory, and none while analytics are off. ## What is counted - **Visitors**, **visits** (a visit ends after 30 minutes without activity), **pageviews**, **bounce rate** (visits of one page), **visit duration**, and the visitors **active** in the last 30 minutes. - Top **pages**, **entry** and **exit pages**, **referrers** (other sites only), **UTM** source, medium and campaign, and the **keys** of query parameters (their values may be tokens, so they are not kept). - **Browsers**, **operating systems**, **devices** (from the user agent and screen size), **screen sizes** and **languages**. - **Countries**, when the domain is behind Cloudflare's proxy (from its `CF-IPCountry` header; there is no GeoIP database). - Single-page apps: each `history.pushState` navigation is a pageview. Bots, crawlers, link previews and scripts are left out by their user agent. ### Comparing and live Each number shows its change from the same span just before (the 7 days before the last 7 days, say), green when it's better: more visitors, a lower bounce rate. Hover it to see the span. **Live** shows the last 30 minutes, minute by minute, refreshed every few seconds: the visitors active now, the pages they're on and where they came from, and their visits as they happen. ### Visits Under the lists, **Visits** shows the range's visits, newest first: when, who (country, browser, OS and device, or the identity below), where they came from, pages, events and duration. Click one to see its journey: the pages in order with their times and titles, and the custom events with their properties. A visitor is only recognized **within a day** (see [Privacy](#privacy)): the same person tomorrow is a new visitor, and their visits aren't linked. ### Identifying users An app that already knows who is signed in can name the visitor: ```js kipitiny.identify("user-42", { plan: "pro" }); ``` The id (up to 128 characters) is kept on the visit, with its properties, and sent with every hit of the page after it. It shows in **Visits** and in the **Identified users** list; clicking one filters the tab to that user's visits, across days. This links one person's visits over time, which the cookieless counting otherwise never does: whether your users agreed to it is your app's question, as for any data you keep about them. Prefer an opaque id over an email. It's stored in the analytics volume only, and deleted with the visit after the retention. An app's stats start when it got its domain (or turned analytics on): a domain another app used before brings none of that app's visits. ### Filters Click a value in any list (a page, a referrer, a country…) to narrow the whole tab to it; filters add up, and each chip removes its own. A filter on a page, referrer, UTM tag, query key, browser, OS, device, screen, language or country keeps the matching pageviews and events; one on an entry or exit page, a custom event or an identified user keeps the visits that have it. Filters apply to **Visits** too. `get_analytics` and `list_visits` take the same filters, as `filters: ["countries:FR", "pages:/pricing"]`. ### Custom events ```js kipitiny.track("signup", { plan: "pro" }); ``` or, without code, on what gets clicked: ```html ``` Up to 20 properties per event, strings, numbers or booleans. Events and their properties have their own lists in the Analytics tab. ### Goals and funnels **Funnel**, under the lists, follows the range's visits through 2 to 8 steps in order: each a **page** (a path, like `/pricing`) or a custom **event** (like `signup`, see [Custom events](#custom-events)). A visit reaches a step when it has it after the step before, within the same visit (30 minutes of inactivity end one); its first step must fall in the range. Each step shows its visits, the share of the step before and of the first. A goal is a funnel ending on it: `page:/` then `event:signup`. The steps are kept in your browser, per app. Filters don't narrow the funnel. `GET /api/services/{id}/analytics/funnel?step=page:/&step=event:signup&from=…&to=…` and the MCP tool `get_funnel` give the same counts. ### Exporting **Export CSV**, next to the range, downloads the range shown, its filters applied, as one of four tables: - **Summary**: visitors, visits, pageviews, bounces and the summed duration (seconds), with the span before. - **Traffic over time**: pageviews and visitors per hour or day (UTC times). - **Breakdowns**: the top 20 values of every list, as `breakdown,value,visitors,count`. - **Visits**: up to 10,000, newest first, with their identity. Text that starts like a spreadsheet formula (`=`, `+`, `-`, `@`) gets a leading `'`. The same tables come from `GET /api/services/{id}/analytics/export?table=visits&from=…&to=…` (the [API](/docs/api), with the tab's `filter` parameters) and the MCP tool `export_analytics`. ### Sharing To show an app's numbers to someone without an account (a client, your team), its **Settings › Networking › Analytics** has a **Public link**: **Create link** gives a URL like `https://manager.example.com/share/analytics/