Skip to main content

Account

Site settings

What a site measures, and what it throws away at ingest.

PATCH/sites/{siteId}/settings
Change site settings
curl --request PATCH \
  --url 'https://truestat.io/api/v1/sites/{siteId}/settings' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "domain": "<string>",
  "excluded_paths": [
    "<string>"
  ],
  "session_strategy": "first_party_cookie",
  "allowed_hostnames": [
    "<string>"
  ],
  "excluded_countries": [
    "<string>"
  ],
  "excluded_hostnames": [
    "<string>"
  ]
}'
{
  "data": {
    "name": "codivupload.com",
    "active": true,
    "domain": "codivupload.com",
    "excluded_paths": [
      "/admin/*",
      "/internal"
    ],
    "session_strategy": "first_party_cookie",
    "allowed_hostnames": [
      "codivupload.com",
      "www.codivupload.com"
    ],
    "excluded_countries": [
      "DE"
    ],
    "excluded_hostnames": [
      "app.codivupload.com"
    ]
  },
  "meta": {
    "site_id": "6fed8980-a119-4a9c-a4d4-53e448ef9f9e"
  }
}

The half of a site's configuration that can be changed.

Site settings (read) is the neighbour: it carries what you need to read a report correctly — timezone, retention, when measurement began. This one carries what alters collection, and it sits behind settings:write for that reason. Renaming a site is cosmetic; excluding a path stops counting traffic from the moment it is saved.

Changes apply from now on, never backwards

This is the rule to internalise before excluding anything.

Exclusions are applied by the collector, as an event arrives. So:

  • Adding /admin/* removes nothing already recorded

  • Removing it recovers nothing that was dropped while it was there

That is the opposite of a goal rule, which is evaluated when a report is read and therefore rewrites the past. Two features that look similar and behave in opposite directions — worth checking which one you are holding.

Lists are arrays

The dashboard's form takes a textarea and splits on newlines. A JSON caller has a real array and sends one:

{
  "excluded_paths": ["/admin/*", "/internal"],
  "excluded_countries": ["DE", "FR"]
}

The rules are identical either way — the same normalisation, the same patterns, the same limits. Entries are lower-cased and de-duplicated, and a path missing its leading / is given one, because the collector matches against a pathname that always has one.

ListLimit
allowed_hostnames25
excluded_paths50
excluded_hostnames50
excluded_countries100

The domain is always accepted

You never have to include the site's own domain in allowed_hostnames, and you cannot remove it — it is folded into the list on every save.

Changing domain moves no data. Past events keep the hostname they arrived with; what changes is which hostname the collector accepts next. A site pointed at a domain it does not serve simply stops counting.

active is not editable here. Stopping collection is its own decision with its own consequence — the data stays, nothing new arrives — not a field to flip while editing a hostname list.

Session strategy

How a returning visitor is recognised. Changing it affects future visits only: it cannot re-identify anybody already counted, and the switchover looks like a burst of new visitors who are not new.

Cookieless mode covers what each option means for accuracy.

Authorizations

Authorizationstringheaderrequired

An API key from Settings → API keys. Scopes available: analytics:read, sites:read, sites:write, settings:read, settings:write, goals:read, goals:write, funnels:read, funnels:write, notes:read, notes:write, alerts:read, alerts:write, team:read, team:write, revenue:read, revenue:write.

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path parameters

siteIdstring (uuid)pathrequired
The site's id, from `GET /sites`. A site that is not yours and a site that does not exist both answer 403, so this cannot be used to discover other people's ids.

Request bodyapplication/json

namestringbody
domainstringbody
A bare hostname. Changing it does not move existing data.
excluded_pathsstring[]body
Path globs to drop. A leading `/` is added if missing.
session_strategyenum<string>body
How a returning visitor is recognised. Changing it affects future visits only — it cannot re-identify anybody already counted.
options:first_party_cookiesalted_hashcookieless_strict
allowed_hostnamesstring[]body
Extra hostnames to accept. The site's domain is added automatically.
excluded_countriesstring[]body
Two-letter country codes to drop at ingest.
excluded_hostnamesstring[]body
Hostnames to drop at ingest.

Response

application/json

The answer.

dataobject
metaobject