---
title: "Switches counting on"
method: PUT
path: "/lambdas/{privateKey}/analytics"
tags: ["Analytics"]
---

# Switches counting on

`PUT /lambdas/{privateKey}/analytics`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/lambdas/{privateKey}/analytics`
- Auth: none declared

Counting starts with the next request. Nothing happens if it is on already.

## Path parameters

- `privateKey` string, required

## Response `200`

Analytics, switched on

- AnalyticsResponse: What was counted of a lambda's visitors, as its owner is shown it. While counting is switched off, everything from `totals` to `crawlers` is absent.
  - `Enabled` boolean: Whether its visits are counted
  - `Since` string, date-time, nullable: When counting was switched on
  - `Tier` string: `Free`, `Premium` or `Demo` - which decides how many days are shown
  - `Days` integer: How many days this answer covers, today included
  - `Window` integer: The most days its tier shows
  - `Kept` integer: How many days are kept of every lambda, whatever its tier shows
  - `From` string, date: The first day of the answer, in UTC
  - `To` string, date: The last day of the answer: today, in UTC
  - `Earliest` string, date, nullable: The first day anything was counted on - before `from` where more is kept than shown
  - `Totals` AnalyticsTotalsResponse: What was counted over some days, summed.
    - `Hits` integer: Every request answered - pages, the files they load, calls of an API
    - `Views` integer: The requests that were somebody opening a page - people and programs alike
    - `BotViews` integer: Of the views, those of programs rather than people: crawlers, and whatever names no browser. The pages people opened are the views less these.
    - `Visitors` integer: Different people who opened a page, each counted once a day - summed over days, one who came back is counted again
    - `Failed` integer: Requests answered with a server error
    - `Rejected` integer: Requests answered with a client error, not found included
    - `Bytes` integer: What the responses carried, where that was known, in bytes
    - `AverageMillis` number, double: The mean time to answer a request, in milliseconds
  - `Previous` AnalyticsTotalsResponse: What was counted over some days, summed.
    - `Hits` integer: Every request answered - pages, the files they load, calls of an API
    - `Views` integer: The requests that were somebody opening a page - people and programs alike
    - `BotViews` integer: Of the views, those of programs rather than people: crawlers, and whatever names no browser. The pages people opened are the views less these.
    - `Visitors` integer: Different people who opened a page, each counted once a day - summed over days, one who came back is counted again
    - `Failed` integer: Requests answered with a server error
    - `Rejected` integer: Requests answered with a client error, not found included
    - `Bytes` integer: What the responses carried, where that was known, in bytes
    - `AverageMillis` number, double: The mean time to answer a request, in milliseconds
  - `Daily` AnalyticsDayResponse[], nullable: Each day of the answer, oldest first, days without visits included
    - `Date` string, date: The day, in UTC
    - `Totals` AnalyticsTotalsResponse: What was counted over some days, summed.
      - `Hits` integer: Every request answered - pages, the files they load, calls of an API
      - `Views` integer: The requests that were somebody opening a page - people and programs alike
      - `BotViews` integer: Of the views, those of programs rather than people: crawlers, and whatever names no browser. The pages people opened are the views less these.
      - `Visitors` integer: Different people who opened a page, each counted once a day - summed over days, one who came back is counted again
      - `Failed` integer: Requests answered with a server error
      - `Rejected` integer: Requests answered with a client error, not found included
      - `Bytes` integer: What the responses carried, where that was known, in bytes
      - `AverageMillis` number, double: The mean time to answer a request, in milliseconds
  - `Pages` AnalyticsValueResponse[], nullable: The paths that were answered, the most viewed first
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Referrers` AnalyticsValueResponse[], nullable: The sites people came from, by host
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Countries` AnalyticsValueResponse[], nullable: The countries their addresses are registered in, by ISO code; empty where not known
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Devices` AnalyticsValueResponse[], nullable: `desktop`, `mobile`, `tablet`, `bot` or `other`
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Browsers` AnalyticsValueResponse[], nullable: The browsers of people - programs are not counted here
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Systems` AnalyticsValueResponse[], nullable: The operating systems of people
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Crawlers` AnalyticsValueResponse[], nullable: Whose programs came: search engines, AIs, chats showing a preview. The names in `confirmedCrawlers` stand for visits confirmed by their addresses, `unconfirmed` for claims to be one of them from elsewhere, and every other value for a kind of crawler.
    - `Value` string: The path, the host, the country code or the name; `(other)` gathers what did not fit into a day's list
    - `Hits` integer: Requests it was part of
    - `Views` integer: Pages opened it was part of
    - `BotViews` integer: Of those, the pages programs opened rather than people
  - `Updated` string, date-time, nullable: When visits were last written down; the visits since then are not in this answer yet
  - `IntervalSeconds` integer: How often visits are written down, in seconds
  - `ConfirmedCrawlers` string[]: The operators whose crawlers are confirmed by the addresses they publish - Google, Bing, OpenAI, Apple, Perplexity - as far as those could be fetched

## Other responses

- `204`: A response containing no body
- `403`: The lambda is a demo, whose visitors are not counted.
- `404`: No lambda has this editor key. A key that never existed and the key of a deleted lambda are answered alike.

---

[API](https://skmtc.dev/genhttp/apis/genhttp-lambda-api.md) · [All operations](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/revisions/8b36699e03df?raw)
