Skip to content
CLI

CLI-commando's

Elke commandogroep van productmetrics met de commando's, de scope die elk nodig heeft en de belangrijkste flags, plus productmetrics capabilities en productmetrics call.

productmetrics heeft één commando per openbare API-handeling, gegroepeerd op het deel vóór de punt in de capability-ID.

Een commando vinden

De actuele lijst komt altijd van de server:

# elke handeling: commando, scope, of het gegevens wijzigt
productmetrics capabilities
productmetrics capabilities --search "merchant center"
productmetrics capabilities --scope write --json
# één groep
productmetrics <group> --help
# één commando: verzoek, scope, elke flag, een voorbeeld
productmetrics <group> <command> --help

Zo lees je de tabellen

  • Command is productmetrics <group> <command>. productmetrics call <capability-id> voert dezelfde handeling uit: productmetrics call google_ads.list_accounts is productmetrics google-ads list-accounts.
  • What it does linkt naar de pagina van de handeling in de API-referentie, met elk veld.
  • Scope is de ene scope die je inlog nodig heeft. Zie Authenticatie.
  • Must pass vermeldt de flags zonder welke het commando mislukt: de verplichte pad-, query- en bodyvelden, en --body-file, --if-match, --auto-idempotency-key of --yes waar de handeling die nodig heeft. Elke andere flag staat in productmetrics <group> <command> --help.
  • Commando’s gemarkeerd met Deletes kunnen niet ongedaan worden gemaakt. In een terminal vraagt productmetrics je de ID te typen in plaats van --yes.

ID’s komen uit eerdere resultaten, nooit uit gokken: property_id en company_id uit productmetrics whoami, installatie-, koppelings- en scope-ID’s uit productmetrics tracking get-configuration, regel-ID’s uit productmetrics product-rules list.

Onboarding

Waar je staat in de onboarding van Product Metrics, en die verder brengen.

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

Het antwoord bevat journey_stage, user.google_grant, hub.company.next_action en hub.property.next_action.

Workspaces en facturering

CommandWhat it doesScopeMust pass
productmetrics properties listList propertiesread
productmetrics companies listList workspacesread
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 neemt de genodigden als JSON in --invitees (of de hele body in --body). Elke rol is admin, editor of viewer:

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

Google-toegang verlenen, Google Ads-accounts koppelen (wat properties aanmaakt), conversieacties en klantenlijsten.

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

Webshops en tracking

Een webshop koppelen en controleren of aankopen binnenkomen.

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 antwoordt per platform:

PlatformAntwoordExit
Shopifymode: redirect en een authorizationUrl om goed te keuren in het Shopify-beheercentrum4, next_action.type: "browser"
WooCommerce, Shopware 6 (--store-url)mode: plugin_claim en een eenmalige setuptoken om vóór claim.expiresAt in de Product Metrics-plugin te plakken4, next_action.type: "store_plugin"
Lightspeed C-Series (--cluster, --shop-domain, --shop-id, --api-key, --api-secret)mode: provisioning: de koppeling wordt ingericht

Geef ook --auto-idempotency-key mee, zodat een nieuwe poging geen tweede koppeling start. stores connect en stores create-woocommerce-setup-claim verbergen de setuptoken, tenzij je --show-secrets meegeeft. Daarna toont productmetrics tracking get-commerce-configuration dat de koppeling actief wordt.

Een WooCommerce-webshop op plugin 1.0.12 of later stuurt bij het koppelen zijn land en valuta mee. Stel die voor elke andere webshop in met tracking update-scope-dimensions vóór tracking update-margin-policy: de standaardmargekosten (marginDefaultCatalog in tracking get-configuration) vereisen precies één land en één valuta per webshopscope.

Bestemmingen

Bestemmingen voor de Meta Conversions API en de OpenAI Conversions API (ChatGPT Ads), één 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

Instellingen

Instellingen voor Product Segmentation: lezen, een aanbevolen minimum aantal klikken ophalen, een concept bekijken, opslaan. Elk commando neemt --feed-scope (een feed-ID, of 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>"'

Productregels

Regels die segmenten of prioriteiten overschrijven voor de producten waarop ze passen. Elk commando neemt --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

Voorraad

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

Webshopgegevens

De eigen gegevens van de webshop. Bestellingen, Business Health en voorraad vereisen 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 stuurt feedback naar het Product Metrics-team via feedback.send (scope read). Het is geen supportkanaal; laat persoonsgegevens weg. Het bericht kan het argument zijn of --message; --about <capability-id> vult --context en --feature, en --request-id voegt de request-ID van een mislukte aanroep toe.

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

Capabilities en call

productmetrics capabilities toont elke handeling die de server aanbiedt, met het commando dat die uitvoert, de scope en of ze gegevens wijzigt. Met --json heeft elk item ook command, secret_fields en browser_step.

FlagWhat it does
--search <text>Alleen handelingen waarvan de ID, titel of beschrijving deze tekst bevat
--scope read|setup|writeAlleen handelingen die deze scope vereisen

productmetrics call <capability-id> voert een handeling uit op basis van de ID (met _ of -), met dezelfde veldflags als het gegenereerde commando:

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

Flags die elk API-commando neemt

Naast de veldflags neemt elk API-commando deze.

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

Alleen deze commando’s nemen een Idempotency-Key; bij elk ander commando is --auto-idempotency-key of --idempotency-key een gebruiksfout (exitcode 2):

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

Volgende stappen