# POST /websites/:website_id/analytics

**Resource:** [Websites](./websites.md)  
**MCP tool:** `enable_website_traffic_reporting`  
**Scopes:** `websites:write`  
**Write operation:** yes

Connect a website to traffic reporting, so its page views and broken URLs can be read straight from the website record instead of the client's own analytics. Requires that Web Analytics has already been switched on for this site in the hosting dashboard (a one-time manual step); this finds that and links it to the website record. Returns a tracking snippet that must be added to the site's <head> before any data arrives; nothing is reported until it is. Safe to call twice: an already-connected site returns its existing snippet.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `website_id` | path | string | yes | UUID of the website. Get ids from list_websites. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/websites/:website_id/analytics"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"require_approval":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`