Hypertekt › Docs › Guides

Count visitors and what they do

What every published site counts with no setup, how to count the buttons that matter to a business, and how to choose the goals the Visitors tab measures.

Every site published on Hypertekt counts its visitors. There’s nothing to install and no consent banner to add. The counts start with the first publish, and the site’s owners and developers see them in the dashboard’s Visitors tab. This guide covers what’s counted automatically, how to count the links and buttons that matter to a business, and how to choose which actions the Visitors tab treats as the site’s goals.

Actions and goals

  • An action is something a visitor does that’s counted: calling, emailing, asking for directions, sending a form, or tapping a link or button you’ve marked.
  • A goal is an action the site is for. The Visitors tab says how many visits reached a goal.

Until a site chooses its goals, every action counts as a goal. A site chooses goals when only some actions matter. For example, a restaurant that takes bookings online might still count calls and directions, but only a booking is what its site is for.

What’s counted with no setup

The server counts each page as it serves it, so a visitor whose browser blocks scripts is still counted. For each page viewed, the server keeps:

  • the page’s path, without its query string, except for the campaign tags utm_source, utm_medium and utm_campaign
  • the site the visitor came from, like google.com or instagram.com
  • the visitor’s country, the kind of device (phone, tablet or desktop) and the browser

A small script, ht/analytics.js, is added to every published page. It sends what only the browser knows: taps that leave the page, and how fast the page felt to the visitor (Core Web Vitals). These actions are counted with no setup:

Action What the visitor did
call tapped a tel: link
email tapped a mailto: link
directions tapped a link to Google Maps or Apple Maps, like the one ht/map shows
form:<name> sent a form, by its name: form:contact for the form in forms/contact.yaml

A visit is one visitor on one day. Nothing is stored in the visitor’s browser. To tell visitors apart within a day, the server makes an ID from the visitor’s IP address and browser, combined with a secret for that day. Each day’s secret is deleted a day after that day ends, so nobody can be followed from one day to the next. Because the counting stores nothing on the visitor’s device, it needs no consent, and a cookie banner on the site doesn’t need to mention it.

These are never counted:

  • the dashboard’s preview, drafts and tekt start: only the published site is counted
  • bots that say what they are, and requests from Hypertekt itself
  • the site’s own people: opening the live site from a link in the dashboard leaves you out of the counts on that device. For a phone or another computer, open the site once from Your own visits in your own Settings.

Some requests claim to be a browser but come from a data center rather than from a home, an office or a phone. These requests are counted separately as automated visits and are never included in the visit counts.

A booking link, an order button or a link to a shop on another site isn’t counted until it’s marked. Give it a data-ht-action attribute with a name for the action:

<a class="button" href="https://booking.example.com/your-business" data-ht-action="booking">Book a table</a>

A tap on the link is counted as booking, and so is a tap on anything inside the link, like an icon. The attribute works on any element a visitor can tap, including a <button>.

  • The name is up to 40 characters: letters, digits, spaces, and ., :, / or -. Use one short name for each thing a visitor can do (booking, order, gift-card). Use the same name on every page where that action appears, so its taps are counted together.
  • Keep the name once the site is live. Taps are counted by name, so a renamed action starts again from zero. Its earlier taps stay under the old name.
  • The dashboard shows what the element says. The Visitors tab calls this action “Book a table”, which is the text on the link. When the element has no text, like a button that’s only an icon, give it an aria-label. Visitors using a screen reader need that label anyway. When elements with the same name show different text, the dashboard uses the text most of them show.
  • Phone, email and map links don’t need it. They’re counted as call, email and directions automatically. A data-ht-action on one of these links counts it under that name instead.

A link that stays on the site, like one to the menu page, doesn’t need marking: the page it opens is counted as a view.

Choose the site’s goals

Until goals are chosen, the Visitors tab counts a visit as reaching a goal when the visit took any action. The Visitors tab labels these visits Got in touch when the site’s only actions are calls, emails, directions and forms. Once the site has actions of its own, the label is Reached a goal.

To count only some actions as goals, list them in site.yaml:

analytics:
  goals: [booking, form:contact]

Each goal is an action’s name: a name from the table above, or one of your own data-ht-action names. With these goals, a visit that only called or asked for directions counts as Looked around. The label for visits that reached a goal depends on the goals: Got in touch when every goal is a call, email, directions or form, and Reached a goal otherwise.

  • Owners can choose goals too. The site’s Settings › Site has What a visit is for, which lists every action on the draft’s pages by its text on the site. Choosing goals there writes the same analytics.goals.
  • A goal that no page has gets a warning (unknown-goal) on its line in site.yaml, since no visit could reach that goal. Usually the name is misspelled, or the button was removed from the site. The warning suggests a fix: the closest action name, or the data-ht-action to add.
  • Goals apply to the days already counted. Each visit’s actions are kept, so choosing or changing goals also changes how earlier visits are judged.

A site with nothing to tap, like a portfolio or a blog, is judged instead by whether its visits read on past their first page. That way, the site isn’t shown as one where nobody did anything.

Turn it off

For a site that counts its visitors some other way, or whose owner wants no counting at all:

analytics: false

The script isn’t added, and nothing is counted. Other analytics, like Google Analytics or Plausible, are added the usual way, and work beside the built-in counting or without it: see Analytics, other scripts and secrets.

Check it

  • Before publishing: the build checks analytics in site.yaml and warns about a goal that no page has. The warning shows in tekt build, tekt start and the dashboard’s Checks tab. What a visit is for in Settings › Site lists every action on the draft’s pages, so it’s a quick way to see that a new button is marked.
  • After publishing: the script is only on the published site. Tap the button on the live site from a device that isn’t left out of the counts. A private window works, since it starts without the dashboard’s cookie. The tap shows in the Visitors tab’s What visitors did within a few minutes.