Skip to content
On this page

Analytics

Which pages are read, and what readers search for without finding it: analytics shows where the docs help and where they fall short. Clay works with three services that set no cookies and keep no personal data: Plausible, Umami and GoatCounter. Each can be used as a hosted service or run on your own server.

analytics:
  plausible: {}

The site’s domain comes from siteURL; set domain if Plausible knows the site by another name. For your own server, set src:

analytics:
  plausible:
    domain: "docs.example.com"
    src: "https://stats.example.com/js/script.js"

Tip

This site counts with GoatCounter: goatcounter: {code: "clay"}.

#What is counted

  • Page views, also when readers move from page to page without the browser loading a new page.
  • Searches without results, with what was searched for, a moment after the reader stops typing. These show what your docs are missing.
  • Copied code and prompts, and the page menu: copying or opening a page as Markdown, and asking ChatGPT or Claude about it.
  • Answers to “Was this page helpful?”, see below.

To count page views only:

analytics:
  plausible: {}
  events: false

In Plausible, events show up once you add them as goals, e.g. “Search without results”. Umami and GoatCounter list them on their own.

#Was this page helpful?

With analytics set up, every page ends with the question “Was this page helpful?” and a yes and a no. An answer is counted as the event “Page feedback”, with the page and yes or no, and the question makes way for a thank-you. Pages with many no’s are the ones to improve first.

A page is answered once while the site is open. The answer is not stored on the reader’s device, so a later visit asks again. Readers whose browser asks not to be tracked do not see the question, as nothing would count it, and neither does anyone with events: false. To keep the other events without the question:

analytics:
  plausible: {}
  feedback: false

#When nothing is counted

  • During clay dev: analytics only runs in built sites.
  • For readers who ask not to be tracked: browsers with Global Privacy Control or Do Not Track turned on load no analytics at all.

#Data protection

Note

This is an overview, not legal advice. Your site’s privacy policy and the rules that apply to it are yours to check.

In the EU, storing or reading anything on a reader’s device, like a cookie, needs their consent unless it is strictly necessary (the ePrivacy Directive, in Germany the TDDDG), and personal data such as IP addresses needs a legal basis under the GDPR.

The three services are built so that this stays simple: they set no cookies and use nothing else on the reader’s device, and they do not store IP addresses or other personal data, only counts. That is why they are commonly used without a consent banner, on the basis of a legitimate interest. What remains for you:

  • Mention the service in your privacy policy: what is counted, by whom, and why.
  • Sign the service’s data processing agreement, when you use it as a hosted service. Plausible and GoatCounter are hosted in the EU; with your own server, the data never leaves it.
  • Search queries are text readers type. If your readers might type personal data into the search, turn events off with events: false.

Services that set cookies, like Google Analytics, need consent before they load, and with it a consent banner. Clay does not ship one. If you need such a service, add its script with head and a consent tool of your choice.