Cohorts
A cohort is a group of people picked by how they started, such as everyone whose first visit came in the last week of August, or who first signed up in August. Pick it from a report’s Filter menu to see every visit of theirs in the period, and nobody else’s. It needs a site that recognizes returning visitors.
Who can be in a cohort
Only recognized visitors. A site is cookieless by default: each visitor gets a daily code that can’t be followed to another day, so its cohorts stay empty. To recognize returning visitors:
An admin turns it on in Settings › General › Tracking: under Visitors, choose Recognize returning visitors and save.
Add data-remember to the script tag only for visitors who agree, for example through your consent tool. The script reads it as it loads (Tag options).
Visitors without it keep a daily code and are never in a cohort, even on a site that recognizes others.
This needs consent in the EU and UK. Recognizing returning visitors keeps a random ID in the visitor’s browser, so add data-remember only after they agree. Where your visitors are decides what else you need (consent, by place).
Make a cohort
Open Settings › Cohorts and select New cohort…, or select it in Filter › Cohorts on any report.
Under People whose first, choose visit, or page view or event. For a page view or event, pick a goal, a page, or a custom event, or type a path (it can end in *) or an event’s name.
Pick the days it fell on: a first and a last day. A new cohort starts with the 30 days before today.
Optionally, a channel: the one the visit they started in came from, such as Search. Any channel is the default.
Check the count and save. The dialog says how many recognized visitors match now. Until you type a name, it’s named after what it is, such as “First came via Search” and its days. Select Save cohort.
Save one from Retention
Retention groups recognized visitors by the day, week, or month they started. Select a row’s label for three choices:
- See them in Overview opens the cohort without saving it. It’s listed first in Filter › Cohorts as “Not saved”, with Save this cohort…
- Save as a cohort… names and saves it.
- Their visits in Sessions opens it in Sessions the same way, while the site’s Individual visits is on. It’s off by default, and then Sessions lists no visits and doesn’t apply the cohort.
A row’s cohort keeps how they started, the row’s days, and a Channel filter if one is on. Other filters, the segment, and a cohort in use aren’t part of it, and the menu says so. A row that starts or ends partway through a day, in a period zoomed to hours, can’t become a cohort.
Use a cohort in a report
- Pick it in Filter › Cohorts. Select it again to take it off, or select × on its chip, “Cohort” and its name. The status line says “1 cohort”.
- Every visit of theirs in the period counts, before or after they started, and nobody else’s. The Overview then shows what those people did; Funnels and Journeys, how they moved.
- It combines with a segment and filters, which narrow it further.
- It stays on as you move between reports from the sidebar. Realtime, Heatmaps, and Errors don’t take cohorts.
How a cohort is counted
- First visit: recognized visitors whose first visit came on the cohort’s days.
- Page view or event: recognized visitors who viewed the page or sent the event for the first time on those days. We look back to the site’s first day with data, so someone who did it earlier isn’t in a cohort for later days.
- Channel: the visit they started in must have come from it.
A cohort is stored as its rule, never as a list of people. Who’s in it is worked out from the visits each time a report reads it, so a cohort whose days include today grows as people start. Settings › Cohorts shows how many recognized visitors each has now.
Change or delete a cohort
In Settings › Cohorts, select Edit (the pencil) beside a cohort, change it, then Save changes. Select Delete (the trash can), then Delete cohort to confirm; it can’t be undone. Reports that use a deleted cohort show everyone instead, and a link that still names it shows its chip as deleted.
Admins and members alike can save, change, and delete cohorts.
In the API and MCP
The API and assistants connected with MCP take a saved cohort by its ID: the value after cohort= in a report’s address once you pick it. IDs start with ch_. A cohort opened from Retention without saving has no ID, so save it first.
curl -G https://app.lyli.io/api/v1/sites/s_k3m9x2p7qa/overview \
-H "Authorization: Bearer $LYLI_API_KEY" \
-d period=30d \
-d cohort=ch_…Limits
- Up to 50 cohorts a site, each named in up to 60 characters. A cohort’s days can span up to 760 days.
- Sample sites have fixed cohorts to try, and can’t save any. In the live demo, harbor.example has First came the last week of August, Signed up in August, and First came from search.
- Share links never show cohorts.
- Saved reports don’t keep a cohort. Pick it from Filter.
- History imported from Google Analytics is daily totals that don’t say who did what, so the Overview leaves imported days out under a cohort, and says so.