Recognize returning visitors
By default Lyli stores nothing in your visitors’ browsers, so someone who comes back on another day counts as a new visitor that day. A site can instead recognize returning visitors: the script keeps a random ID in the browser of each visitor who agrees, and their visits link up across days. This article is for the admins who set up a site and whoever adds its script.
Cookieless by default
A new site is Cookieless. To tell visits apart within a day, we turn the IP address and the browser identification into a code, mixed with a random value that changes every day (UTC). Each day’s value is deleted within 2 days, so the codes can’t be followed from one day to the next.
So a person who visits on three days of a month counts as a visitor on each of those days, and three times in the month’s total. Their visits on one day share a code, as long as their IP address and browser stay the same.
What recognizing adds
For visitors who are recognized, these reports see the same person across days:
Turn it on
Choose it in the site’s settings. Open the site’s Settings › General, then Tracking. Under Visitors, choose Recognize returning visitors and select Save changes. Only admins can change it. You can also choose it under Visitor identity when you add a site.
Add data-remember to the script tag only for visitors who agreed (below). The tag on Settings › Install always leaves it out.
Check it in Retention. Until a visitor comes with data-remember, it says “No recognized visitors yet.” After that, its Recognized tile shows the share.
<script defer src="https://app.lyli.io/t.js" data-site="s_k3m9x2p7qa" data-remember></script>s_k3m9x2p7qa stands for your site’s ID. With Via your domain, add data-remember to that tag the same way.
Add it only after consent
The ID is stored in the visitor’s browser, so in the EU and UK this needs the visitor’s consent. That’s why the attribute goes on the tag only for visitors who agree, for example through your consent tool. Everyone else gets a daily code, as before.
- Decide before the tag is on the page. The script reads
data-rememberonce, as it loads. Render the tag with it for visitors who have already agreed (your server can read the choice your consent tool stored), and without it for everyone else, or let your consent tool add the tag. - Agreeing partway through a page counts from the next page load. That page load starts a new visit under the recognized ID, so on the day they agree they count as two visitors with two visits. Don’t add a second copy of the tag to switch it on: each copy sends its own page views, so they’d be counted twice.
- If a visitor withdraws consent, render the tag without
data-rememberfrom then on, and remove the stored ID withlocalStorage.removeItem("_aid")on a page loaded without it, for example from your consent tool as each page loads for visitors who declined. On the page where they withdraw, the script was loaded with the attribute, so the next thing it sends (a page view, an event, or the page-speed report it sends as the page is left) stores a new ID. From their next page load they get a daily code, which starts a new visit.
The cookieless default may need consent too. That depends on the country; in Sweden and Germany, assume it does. Using Lyli doesn’t by itself make your site compliant. See Consent by place, which is general information, not legal advice.
What’s stored
_aid, not a cookie. It has no expiry: it stays until the visitor clears their browser’s storage or your site removes it. Some browsers clear it on their own; Safari, for example, after 7 days of use in which the visitor doesn’t interact with your site. The script sends it with each page view, event, and page-speed report.Limits and edge cases
- One ID per browser and hostname. Local storage belongs to one hostname, so a visitor on harbor.example and docs.harbor.example gets an ID on each and counts as two visitors. Another device or browser, a private window, or cleared storage means a new ID.
- A browser that won’t store it sends no ID, and the visitor gets a daily ID.
data-rememberon a Cookieless site still makes the script store the ID in the browser, but we ignore it. Add the attribute only once the setting is on.- Earlier visits aren’t linked. Visits from before you turned it on, or before a visitor agreed, keep their daily codes. When a period starts before that, Retention says from which day it recognizes visitors.
- Switching back to Cookieless makes us ignore the ID from then on. Remove
data-rememberfrom your tag too, or the script keeps storing it. - Individual visits is a separate switch, off by default for every site. Recognizing returning visitors doesn’t turn it on.