---
title: "Change a project's analytics traffic settings. Applies to events ingested from now on; already-recorded events keep their classification."
method: PATCH
path: "/projects/{project_id}/analytics/settings"
tags: ["Analytics Settings"]
---

# Change a project's analytics traffic settings. Applies to events ingested from now on; already-recorded events keep their classification.

`PATCH /projects/{project_id}/analytics/settings`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/analytics/settings`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- UpdateProjectAnalyticsSettingsRequest: Fields to change. Omitted fields keep their current value.
  - `exclude_datacenter_traffic` boolean, nullable
  - `exclude_spam_referrers` boolean, nullable

## Response `200`

Updated analytics settings

- ProjectAnalyticsSettingsResponse: Analytics traffic settings for a project.
  - `datacenter_detection` DatacenterDetectionStatus, required: Whether datacenter traffic can be detected on this instance at all.
    - `asn_database_built_at` string, nullable: When the loaded ASN database was built (ISO 8601), if one is loaded.
    - `available` boolean, required: `true` when an ASN database is loaded and IPs are being classified.
    - `reason` string, nullable: Why detection is unavailable, when `available` is false.
    - `setup_path` string, nullable: Console path where the operator can fix it, when `available` is false.
  - `exclude_datacenter_traffic` boolean, required: Exclude visits from hosting/cloud/VPS networks (AWS, Google Cloud, Tencent, Alibaba, Hetzner, ...) from every analytics report. Privacy relays such as iCloud Private Relay are never treated as datacenters.
  - `exclude_spam_referrers` boolean, required: Exclude visits whose referrer is on the bundled referrer-spam list (domains that exist only to plant fake referrals).
  - `project_id` integer, required
  - `spam_referrer_list_size` integer, required: Number of domains on the bundled referrer-spam list.
  - `updated_at` string, nullable: When the settings were last changed (ISO 8601). `null` while the project still uses the defaults.

## Other responses

- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Project not found
- `500`: Internal server error

## Changes

- **2026-10-30** `0c5d6f73ba5b`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/analytics/settings/patch.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
