Send a store's purchases to Google Ads
Points one storefront scope of an installation at a property: its purchases go to that property's Google Ads purchase conversion action, and pageviewDestination sets where pageviews go (null for none).
PUT /companies/{companyId}/tracking/scopes/{scopeId}/destination
Scope setup · Access Changes data · Operation id tracking.set_scope_destination
Try it
productmetrics runs after productmetrics login; curl needs PM_TOKEN (see Authentication). Set $COMPANY_ID, $SCOPE_ID first.
productmetrics tracking set-scope-destination \
--company-id $COMPANY_ID \
--scope-id $SCOPE_ID \
--installation-id 6f1c2a7e-3b4d-4e8f-9a01-2c3d4e5f6a7b \
--property-id 8c1f4d2e-7a3b-4c5d-9e6f-0a1b2c3d4e5f \
--pageview-destination / \
--consent-policy-version 1 \
--jsonResponse
API response (200):
{
"data": {
"storefront_scope_id": "6f1c2a7e-3b4d-4e8f-9a01-2c3d4e5f6a7b",
"destination_mapping_id": "6f1c2a7e-3b4d-4e8f-9a01-2c3d4e5f6a7b",
"destination_mapping_version": 1,
"desired_revision": 1
},
"request_id": "req_01JPXA468G7BQ25FD996347K02"
}CLI output: productmetrics tracking set-scope-destination --json prints { "ok": true, "data": …, "request_id": "…" } with the same data.
Before you call
Needs editor or admin access, a Google Ads account connected to the property and its purchase conversion action; otherwise answers 409 naming what is missing. installationId, the scope id and consentPolicyVersion come from tracking.get_configuration; read it again afterwards to check the change.
Path parameters
| Name | Type | Description |
|---|---|---|
companyId | string (uuid) | Your workspace id, from productmetrics whoami or properties.list (company_id). |
scopeId | string (uuid) | The tracking scope: its id from tracking.get_commerce_configuration or tracking.get_configuration. |
Body
| Name | Type | Required | Description |
|---|---|---|---|
installationId | string (uuid) | Yes | The tracking installation: installationId from tracking.get_commerce_configuration or tracking.get_configuration. |
propertyId | string | Yes | The property id, from productmetrics whoami or properties.list (property_id). |
pageviewDestination | string or null | Yes | Points one storefront scope of an installation at a property: its purchases go to that property’s Google Ads purchase conversion action, and pageviewDestination sets where pageviews go (null for none). 1 to 200 characters. |
consentPolicyVersion | integer | Yes | installationId, the scope id and consentPolicyVersion come from tracking.get_configuration; read it again afterwards to check the change. Above 0. |
Errors
A failure answers with its HTTP status and { error: { code, message, details? }, request_id }. Branch on code (stable, lower_snake); show message to the person. The CLI prints the same error with "ok": false.
{
"error": {
"code": "insufficient_scope",
"message": "This operation needs the setup scope; connect again and allow it.",
"details": {
"required_scope": "setup"
}
},
"request_id": "req_01JFZQ41YSGT76Z9EHXM47PPC3"
}| Status | Code | When |
|---|---|---|
| 400 | invalid_request | A path, query or body value does not match this page. details.issues lists each location, path and message. |
| 401 | invalid_token | The token is missing, expired or revoked: sign in again (productmetrics login). The WWW-Authenticate header says why. |
| 403 | insufficient_scope | The token lacks the setup scope (details.required_scope): sign in again and allow it. |
| 404 | not_found | An id in the path does not exist, or the signed-in person cannot open it. |
| 409 | conflict | Needs editor or admin access, a Google Ads account connected to the property and its purchase conversion action; otherwise answers 409 naming what is missing. |
| 429 | rate_limited | More than 600 requests a minute for this person: wait the Retry-After seconds (60) and retry. |