Skip to content
Stores and tracking

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 \
  --json

Response

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

NameTypeDescription
companyIdstring (uuid)Your workspace id, from productmetrics whoami or properties.list (company_id).
scopeIdstring (uuid)The tracking scope: its id from tracking.get_commerce_configuration or tracking.get_configuration.

Body

NameTypeRequiredDescription
installationIdstring (uuid)YesThe tracking installation: installationId from tracking.get_commerce_configuration or tracking.get_configuration.
propertyIdstringYesThe property id, from productmetrics whoami or properties.list (property_id).
pageviewDestinationstring or nullYesPoints 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.
consentPolicyVersionintegerYesinstallationId, 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"
}
StatusCodeWhen
400invalid_requestA path, query or body value does not match this page. details.issues lists each location, path and message.
401invalid_tokenThe token is missing, expired or revoked: sign in again (productmetrics login). The WWW-Authenticate header says why.
403insufficient_scopeThe token lacks the setup scope (details.required_scope): sign in again and allow it.
404not_foundAn id in the path does not exist, or the signed-in person cannot open it.
409conflictNeeds editor or admin access, a Google Ads account connected to the property and its purchase conversion action; otherwise answers 409 naming what is missing.
429rate_limitedMore than 600 requests a minute for this person: wait the Retry-After seconds (60) and retry.

All Stores and tracking operations