Skip to content
CLI

CLI commands

Every productmetrics command group with its commands, the scope each needs and its key flags, plus productmetrics capabilities and productmetrics call.

productmetrics has one command per public API operation, grouped by the part before the dot in its capability id. The live list always comes from the server:

# every operation: command, scope, whether it changes data
productmetrics capabilities
productmetrics capabilities --search "merchant center"
productmetrics capabilities --scope write --json
# one group
productmetrics <group> --help
# one command: request, scope, every flag, an example
productmetrics <group> <command> --help

How to read the tables

  • Command is productmetrics <group> <command>. productmetrics call <capability-id> runs the same operation: productmetrics call google_ads.list_accounts is productmetrics google-ads list-accounts.
  • What it does links to the operation’s API reference page, with every field.
  • Scope is the one scope your sign-in needs. See Authentication.
  • Must pass lists the flags the command fails without: its required path, query and body fields, and --body-file, --if-match, --auto-idempotency-key or --yes where the operation needs them. Every other flag is in productmetrics <group> <command> --help.
  • Commands marked Deletes cannot be undone. In a terminal, productmetrics asks you to type the id instead of --yes.

Ids come from earlier results, never from guesses: property_id and company_id from productmetrics whoami, installation, connection and scope ids from productmetrics tracking get-configuration, rule ids from productmetrics product-rules list.

Onboarding

Where you are in Product Metrics onboarding, and moving it forward.

CommandWhat it doesScopeMust pass
productmetrics onboarding get-stateGet onboarding stateread
productmetrics onboarding update-stepMove onboarding to a stepsetup--step
productmetrics onboarding set-account-typeSet account typesetup--account-type
productmetrics onboarding set-google-ads-connection-modeSet Google Ads connection modesetup--google-ads-connection-mode
productmetrics onboarding completeComplete onboardingsetup
productmetrics onboarding skipSkip onboardingsetup

Setup

CommandWhat it doesScopeMust pass
productmetrics setup get-statusGet setup statusread

The answer carries journey_stage, user.google_grant, hub.company.next_action and hub.property.next_action.

Workspaces and billing

CommandWhat it doesScopeMust pass
productmetrics properties listList propertiesread
productmetrics companies createCreate workspacesetup--name, --auto-idempotency-key
productmetrics billing create-checkout-linkCreate a checkout linksetup--company-id
productmetrics invitations sendInvite teammateswrite--company-id, --invitees
productmetrics usage get-ad-spendGet ad spend usageread--company-id, --start-date, --end-date

invitations send takes the invitees as JSON in --invitees (or the whole body in --body). Each role is admin, editor or viewer:

productmetrics invitations send \
  --company-id <company_id> \
  --invitees '[{ "email": "anna@example.com", "role": "editor" }]'

Granting Google access, connecting Google Ads accounts (which creates properties), conversion actions and customer lists.

CommandWhat it doesScopeMust pass
productmetrics google get-connect-linkGet the Google connect linksetup--scope
productmetrics google-ads list-accountsList reachable Google Ads accountsread
productmetrics google-ads list-property-connectionsList Google Ads connectionsread--company-id
productmetrics google-ads create-property-connectionConnect a Google Ads accountsetup--company-id, --connection-mode, --customer-id
productmetrics google-ads list-pending-invitesList pending Google Ads invitesread--company-id
productmetrics google-ads send-inviteInvite a Google Ads accountsetup--company-id, --customer-id
productmetrics google-ads recheck-property-connectionRecheck a Google Ads connectionsetup--property-id
productmetrics google-ads delete-property-connectionDeletes. Disconnect a Google Ads accountsetup--property-id, --yes
productmetrics google-ads get-setup-statusGet workspace setup statusread--company-id
productmetrics google-ads get-plan-resultsGet plan resultsread--property-id
productmetrics google-ads get-conversion-actionsGet conversion action readinessread--property-id
productmetrics google-ads create-conversion-actionsCreate conversion actionssetup--property-id, --company-id
productmetrics google-ads get-customer-listsGet customer listsread--property-id, --company-id
productmetrics google-ads create-customer-listsCreate customer listssetup--property-id, --company-id

Merchant Center

CommandWhat it doesScopeMust pass
productmetrics merchant-center create-connectionConnect Merchant Centersetup--property-id, --merchant-id
productmetrics merchant-center recheck-connectionRecheck a Merchant Center connectionsetup--property-id
productmetrics merchant-center delete-connectionDeletes. Disconnect Merchant Centersetup--property-id, --yes
productmetrics merchant-center inspect-auto-setupInspect Merchant Center auto-setupread--property-id
productmetrics merchant-center get-auto-setup-statusGet Merchant Center auto-setup statusread--property-id
productmetrics merchant-center apply-auto-setupApply Merchant Center auto-setupsetup--property-id

Stores and tracking

Connecting a store and checking that purchases arrive.

CommandWhat it doesScopeMust pass
productmetrics stores select-platformChoose the store platformsetup--company-id, --platform
productmetrics stores connectConnect a storesetup--company-id, --provider
productmetrics stores create-woocommerce-setup-claimNew WooCommerce setup tokensetup--installation-id
productmetrics tracking get-configurationGet tracking configurationread--company-id, --property-id
productmetrics tracking get-commerce-configurationGet store connectionsread--company-id
productmetrics tracking create-website-installationTrack a websitesetup--company-id, --verified-domain
productmetrics tracking get-last-purchaseCheck tracking worksread--company-id, --installation-id
productmetrics tracking get-shopware6-statusGet Shopware 6 statusread--company-id, --installation-id
productmetrics tracking update-installation-featuresSet the cookie consent manager and tracking featuressetup--company-id, --installation-id, --identity-discovery, --dynamic-checkout-observation, --cmp-adapter, --expanded-bot-signals, --server-authoritative-attribution-mode
productmetrics tracking update-margin-policySet the profit cost fallback and margin costssetup--company-id, --connection-id, --expected-revision, --policy, --auto-idempotency-key
productmetrics tracking update-scope-dimensionsSet a store’s countries and currenciessetup--company-id, --scope-id, --installation-id, --country-codes, --path-prefixes, --locale-codes, --currency-codes
productmetrics tracking set-scope-destinationSend a store’s purchases to Google Adssetup--company-id, --scope-id, --installation-id, --property-id, --pageview-destination, --consent-policy-version
productmetrics tracking assign-propertyAssign a store to a propertysetup--company-id, --scope-id, --installation-id, --property-id
productmetrics tracking get-enhanced-conversionsGet enhanced conversions readinessread--company-id, --property-id

stores connect answers per platform:

PlatformAnswerExit
Shopifymode: redirect and an authorizationUrl to approve in Shopify Admin4, next_action.type: "browser"
WooCommerce, Shopware 6 (--store-url)mode: plugin_claim and a one-time setup token to paste into the Product Metrics plugin before claim.expiresAt4, next_action.type: "store_plugin"
Lightspeed C-Series (--cluster, --shop-domain, --shop-id, --api-key, --api-secret)mode: provisioning: the connection is being set up

Pass --auto-idempotency-key too, so a retry does not start a second connection. stores connect and stores create-woocommerce-setup-claim hide the setup token unless you pass --show-secrets. Then productmetrics tracking get-commerce-configuration shows the connection become active.

A WooCommerce store on plugin 1.0.12 or later sends its country and currency when it pairs. For any other store, set them with tracking update-scope-dimensions before tracking update-margin-policy: the default margin costs (marginDefaultCatalog in tracking get-configuration) need exactly one country and one currency per store scope.

Destinations

Meta Conversions API and OpenAI Conversions API (ChatGPT Ads) destinations, one per property.

CommandWhat it doesScopeMust pass
productmetrics destinations list-metaList Meta destinationsread--company-id
productmetrics destinations set-metaSave Meta destinationsetup--company-id, --property-id, --pixel-id, --test-event-code, --enabled
productmetrics destinations test-metaSend Meta test eventsetup--company-id, --property-id
productmetrics destinations delete-metaDeletes. Delete Meta destinationsetup--company-id, --property-id, --yes
productmetrics destinations list-openaiList ChatGPT Ads (OpenAI Conversions API) destinationsread--company-id
productmetrics destinations set-openaiSave ChatGPT Ads (OpenAI Conversions API) destinationsetup--company-id, --property-id, --pixel-id, --enabled
productmetrics destinations test-openaiSend ChatGPT Ads (OpenAI Conversions API) test eventsetup--company-id, --property-id
productmetrics destinations delete-openaiDeletes. Delete ChatGPT Ads (OpenAI Conversions API) destinationsetup--company-id, --property-id, --yes

Settings

Product Segmentation settings: read, get a recommended minimum clicks, preview a draft, save it. Every command takes --feed-scope (a feed id, or all).

CommandWhat it doesScopeMust pass
productmetrics settings getGet Product Segmentation settingsread--property-id
productmetrics settings recommend-min-clicksRecommend minimum clicksread--property-id
productmetrics settings previewPreview Product Segmentation settingsread--property-id, --body-file
productmetrics settings preview-strategyPreview segmentation strategyread--property-id, --body-file
productmetrics settings updateSave Product Segmentation settingswrite--property-id, --labelizer-settings
productmetrics settings get --property-id <property_id> --json > settings.json
productmetrics settings recommend-min-clicks --property-id <property_id>
productmetrics settings preview \
  --property-id <property_id> \
  --feed-scope <feed> \
  --body-file draft.json
productmetrics settings update \
  --property-id <property_id> \
  --body-file new-settings.json \
  --if-match '"<settings_version>"'

Product rules

Rules that override segments or priorities for the products they match. Every command takes --feed-scope.

CommandWhat it doesScopeMust pass
productmetrics product-rules listList product rulesread--property-id
productmetrics product-rules get-impactGet product rules impactread--property-id
productmetrics product-rules previewPreview product rule conditionsread--property-id, --when-cols, --when-ops, --when-vals
productmetrics product-rules createCreate a product rulewrite--property-id, --name, --when-cols, --when-ops, --when-vals, --target-cols, --action, --action-value
productmetrics product-rules reorderReorder product ruleswrite--property-id, --rules
productmetrics product-rules updateUpdate a product rulewrite--property-id, --rule-id
productmetrics product-rules toggleTurn a product rule on or offwrite--property-id, --rule-id
productmetrics product-rules deleteDeletes. Delete a product rulewrite--property-id, --rule-id, --yes

Feed

CommandWhat it doesScopeMust pass
productmetrics feed-source-settings getGet feed source settingsread--property-id
productmetrics feed-source-settings updateSave feed source settingswrite--property-id, --product-segment, --category-priority
productmetrics feed generateGenerate the feed nowwrite--property-id

Inventory

CommandWhat it doesScopeMust pass
productmetrics inventory-settings getGet inventory planning settingsread--property-id
productmetrics inventory-settings updateSave an inventory planning settingwrite--property-id, --store-id, --scope-kind, --lead-time-days, --safety-buffer-days
productmetrics inventory get-stateGet inventory stateread--property-id

Store data

The store’s own data. Orders, Business Health and inventory need Pro.

CommandWhat it doesScopeMust pass
productmetrics orders get-availabilityCheck orders are availableread
productmetrics orders listList ordersread--company-id, --storefront-scope-id
productmetrics orders getGet an orderread--company-id, --order-id, --storefront-scope-id
productmetrics store list-shopsList shopsread--property-id
productmetrics store get-health-sliceGet Business Healthread--property-id, --window-days, --compare
productmetrics store get-health-seriesGet Business Health seriesread--property-id, --weeks, --compare
productmetrics store list-health-productsList Business Health productsread--property-id, --window-days
productmetrics analytics get-statusGet analytics statusread--property-id
productmetrics data queryQuery the lakeread--property-id, --sql
productmetrics insights getGet an insight cardread--property-id, --spot
productmetrics tracking get-configuration \
  --company-id <company_id> \
  --property-id <property_id>
productmetrics orders list \
  --company-id <company_id> \
  --storefront-scope-id <scope_id> \
  --limit 20
productmetrics data query \
  --property-id <property_id> \
  --sql "select count(*) from orders" \
  --max-rows 10

Feedback

productmetrics feedback sends feedback to the Product Metrics team through feedback.send (scope read). It is not a support channel; leave out personal data. The message can be the argument or --message; --about <capability-id> fills --context and --feature, and --request-id adds a failed call’s request id.

productmetrics feedback \
  --sentiment negative \
  --about settings.update \
  --request-id <request_id> \
  --message "The save answered 500 twice."

Capabilities and call

productmetrics capabilities lists every operation the server offers, with the command that runs each, its scope and whether it changes data. With --json, each entry also has command, secret_fields and browser_step.

FlagWhat it does
--search <text>Only operations whose id, title or description contains this text
--scope read|setup|writeOnly operations that need this scope

productmetrics call <capability-id> runs an operation by its id (with _ or -), with the same field flags as the generated command:

productmetrics call google_ads.list_accounts
productmetrics call settings.get --param propertyId=<property_id> --json

Flags every API command takes

Besides its field flags, every API command takes these.

FlagWhat it does
--param <key=value>Set a path parameter by its API name (wins over its field flag)
--query <key=value>Set a query parameter by its API name (wins over its field flag)
--body <json>The JSON body; its keys win over field flags
--body-file <path>Read the JSON body from a file
--body-stdinRead the JSON body from stdin
--idempotency-key <uuid>Idempotency-Key header: the same key makes a retry safe
--auto-idempotency-keySend a new random Idempotency-Key (a failed call prints it for the retry)
--if-match <version>If-Match header: the version of the resource this change is based on
--show-secretsPrint fields the API marks as secret instead of hiding them
--yesConfirm an operation that deletes data, without a prompt
--dry-runPrint the request that would be sent, and send nothing

Only these commands take an Idempotency-Key; on any other, --auto-idempotency-key or --idempotency-key is a usage error (exit 2):

  • productmetrics companies create (required)
  • productmetrics stores connect
  • productmetrics tracking update-margin-policy (required)

Where next