# PATCH /websites/:website_id/google-analytics-link

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

Choose which Google Analytics property measures a website (from list_google_analytics_properties), so get_website_google_analytics_traffic can read it. Optionally give hosts to count only some domains when one property measures several sites. Send property_id null to remove the link. Needs Google Analytics connected. Returns the property now linked; default_set is true when the workspace had no default property yet and this one became it (the property used when a question names no website).

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `website_id` | path | string | yes | UUID of the website. Get ids from list_websites. |
| `property_id` | body | string | yes | The Google Analytics property id that measures this website (from list_google_analytics_properties). Send null to remove the link. |
| `hosts` | body | array | no | Optional: up to 10 bare domains to count, e.g. ["acme.com.au", "www.acme.com.au"], when one property measures several sites. Leave out to count all of the property's traffic. |
| `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 PATCH   "https://api.trustpager.com/functions/v1/api/v1/websites/:website_id/google-analytics-link"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"property_id":"...","hosts":"...","require_approval":"..."}'
```

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