# 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/`. Anyone with it sees the Analytics tab without signing in: the totals, the chart and the lists, over any range of the picker. Never the visits and journeys, the identified users, the custom events' properties, the script or any setting; filters are off. The link is shown once, when created (the manager keeps only a hash of its token): copy it then. An app has one link at a time: **New link** replaces it, and **Revoke** turns it off; the old URL then shows that the link doesn't work anymore. While the app's analytics are off, it shows nothing. Creating or revoking a link needs the *settings* permission. ## Pixels and links For what the script can't see, **Settings › Analytics › Pixels and links** (admins): - A **pixel** is a transparent 1x1 image, `https://stats.example.com/p/.gif`: each load counts a view. Put it in an email, a README badge, or a page you don't control: ```html ``` Mail apps that load images through a proxy (Gmail) or block them by default count fewer, or only the proxy's country. - A **link**, `https://stats.example.com/l/`, redirects to its target and counts the click, with the referrer, country, browser and device. UTM tags in the dialog are added to the target; UTM tags on the link itself (`/l/launch?utm_source=twitter`) are counted as its own source. The slug is random (8 characters) unless you choose one, like `launch`. Bots and link previews (Slack, social networks) are redirected but not counted. Each one's stats open from its row, with the same lists and filters as an app's. Deleting one deletes its counts; a deleted link answers 404. They live in the analytics server's data, so **Delete analytics data** removes them too, and they can only be managed while analytics are on. The MCP tools `list_trackers`, `create_tracker` and `delete_tracker` manage them, and `get_analytics` with `tracker` reads their stats (admin tokens). ## Privacy No cookie, no `localStorage`, no fingerprinting script. A visitor is a hash of the site, the IP address and the user agent with a **salt that changes every day**: the same browser counts once per day, and can't be followed from one day to the next (unless the app [identifies](#identifying-users) them). IP addresses are never stored. Visits older than the retention (**365 days** by default, Settings › Analytics) are deleted every hour. ## Who sees what Anyone who can view a project sees its apps' analytics. Turning an app's analytics on or off needs the *settings* permission; the server's settings are admin-only. A [public link](#sharing) shows the numbers, without the visits or identities, to anyone who has it. The [MCP](/docs/api) tools `get_analytics`, `list_visits` and `get_visit` return the same numbers and journeys to agents. Pixels and links are admin-only. ## Limits - Apps on the manager's server only, for now. - [Previews](/docs/previews) are never counted. - **Disable** stops the server and keeps its data; **Delete analytics data** (shown while it's off) removes it for good.