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.
Waar je staat in de onboarding, en die verder brengen.
De setupstatus en de volgende openstaande stap.
Properties, workspaces, checkout, uitnodigingen en advertentie-uitgaven.
Google-toegang, accounts, conversieacties en klantenlijsten.
Merchant Center koppelen en de automatische setup toepassen.
Een webshop koppelen en controleren of aankopen binnenkomen.
Meta Conversions API en ChatGPT Ads (OpenAI Conversions API).
Instellingen voor Product Segmentation: lezen, voorbeeld bekijken, opslaan.
Regels die segmenten of prioriteiten overschrijven.
Instellingen voor de feedbron en de feed genereren.
Instellingen voor voorraadplanning en de voorraadstatus.
Bestellingen, Business Health, analytics en gegevensopvragingen.
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> --helpZo lees je de tabellen
- Command is
productmetrics <group> <command>.productmetrics call <capability-id>voert dezelfde handeling uit:productmetrics call google_ads.list_accountsisproductmetrics 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-keyof--yeswaar de handeling die nodig heeft. Elke andere flag staat inproductmetrics <group> <command> --help. - Commando’s gemarkeerd met Deletes kunnen niet ongedaan worden gemaakt. In een terminal vraagt
productmetricsje 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.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics onboarding get-state | Get onboarding state | read | |
productmetrics onboarding update-step | Move onboarding to a step | setup | --step |
productmetrics onboarding set-account-type | Set account type | setup | --account-type |
productmetrics onboarding set-google-ads-connection-mode | Set Google Ads connection mode | setup | --google-ads-connection-mode |
productmetrics onboarding complete | Complete onboarding | setup | |
productmetrics onboarding skip | Skip onboarding | setup |
Setup
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics setup get-status | Get setup status | read |
Het antwoord bevat journey_stage, user.google_grant, hub.company.next_action en hub.property.next_action.
Workspaces en facturering
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics properties list | List properties | read | |
productmetrics companies list | List workspaces | read | |
productmetrics companies create | Create workspace | setup | --name, --auto-idempotency-key |
productmetrics billing create-checkout-link | Create a checkout link | setup | --company-id |
productmetrics invitations send | Invite teammates | write | --company-id, --invitees |
productmetrics usage get-ad-spend | Get ad spend usage | read | --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 Ads
Google-toegang verlenen, Google Ads-accounts koppelen (wat properties aanmaakt), conversieacties en klantenlijsten.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics google get-connect-link | Get the Google connect link | setup | --scope |
productmetrics google-ads list-accounts | List reachable Google Ads accounts | read | |
productmetrics google-ads list-property-connections | List Google Ads connections | read | --company-id |
productmetrics google-ads create-property-connection | Connect a Google Ads account | setup | --company-id, --connection-mode, --customer-id |
productmetrics google-ads list-pending-invites | List pending Google Ads invites | read | --company-id |
productmetrics google-ads send-invite | Invite a Google Ads account | setup | --company-id, --customer-id |
productmetrics google-ads recheck-property-connection | Recheck a Google Ads connection | setup | --property-id |
productmetrics google-ads delete-property-connection | Deletes. Disconnect a Google Ads account | setup | --property-id, --yes |
productmetrics google-ads get-setup-status | Get workspace setup status | read | --company-id |
productmetrics google-ads get-plan-results | Get plan results | read | --property-id |
productmetrics google-ads get-conversion-actions | Get conversion action readiness | read | --property-id |
productmetrics google-ads create-conversion-actions | Create conversion actions | setup | --property-id, --company-id |
productmetrics google-ads get-customer-lists | Get customer lists | read | --property-id, --company-id |
productmetrics google-ads create-customer-lists | Create customer lists | setup | --property-id, --company-id |
Merchant Center
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics merchant-center create-connection | Connect Merchant Center | setup | --property-id, --merchant-id |
productmetrics merchant-center recheck-connection | Recheck a Merchant Center connection | setup | --property-id |
productmetrics merchant-center delete-connection | Deletes. Disconnect Merchant Center | setup | --property-id, --yes |
productmetrics merchant-center inspect-auto-setup | Inspect Merchant Center auto-setup | read | --property-id |
productmetrics merchant-center get-auto-setup-status | Get Merchant Center auto-setup status | read | --property-id |
productmetrics merchant-center apply-auto-setup | Apply Merchant Center auto-setup | setup | --property-id |
Webshops en tracking
Een webshop koppelen en controleren of aankopen binnenkomen.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics stores select-platform | Choose the store platform | setup | --company-id, --platform |
productmetrics stores connect | Connect a store | setup | --company-id, --provider |
productmetrics stores create-woocommerce-setup-claim | New WooCommerce setup token | setup | --installation-id |
productmetrics tracking get-configuration | Get tracking configuration | read | --company-id, --property-id |
productmetrics tracking get-commerce-configuration | Get store connections | read | --company-id |
productmetrics tracking create-website-installation | Track a website | setup | --company-id, --verified-domain |
productmetrics tracking get-last-purchase | Check tracking works | read | --company-id, --installation-id |
productmetrics tracking get-shopware6-status | Get Shopware 6 status | read | --company-id, --installation-id |
productmetrics tracking update-installation-features | Set the cookie consent manager and tracking features | setup | --company-id, --installation-id, --identity-discovery, --dynamic-checkout-observation, --cmp-adapter, --expanded-bot-signals, --server-authoritative-attribution-mode |
productmetrics tracking update-margin-policy | Set the profit cost fallback and margin costs | setup | --company-id, --connection-id, --expected-revision, --policy, --auto-idempotency-key |
productmetrics tracking update-scope-dimensions | Set a store’s countries and currencies | setup | --company-id, --scope-id, --installation-id, --country-codes, --path-prefixes, --locale-codes, --currency-codes |
productmetrics tracking set-scope-destination | Send a store’s purchases to Google Ads | setup | --company-id, --scope-id, --installation-id, --property-id, --pageview-destination, --consent-policy-version |
productmetrics tracking assign-property | Assign a store to a property | setup | --company-id, --scope-id, --installation-id, --property-id |
productmetrics tracking get-enhanced-conversions | Get enhanced conversions readiness | read | --company-id, --property-id |
stores connect antwoordt per platform:
| Platform | Antwoord | Exit |
|---|---|---|
| Shopify | mode: redirect en een authorizationUrl om goed te keuren in het Shopify-beheercentrum | 4, 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 plakken | 4, 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.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics destinations list-meta | List Meta destinations | read | --company-id |
productmetrics destinations set-meta | Save Meta destination | setup | --company-id, --property-id, --pixel-id, --test-event-code, --enabled |
productmetrics destinations test-meta | Send Meta test event | setup | --company-id, --property-id |
productmetrics destinations delete-meta | Deletes. Delete Meta destination | setup | --company-id, --property-id, --yes |
productmetrics destinations list-openai | List ChatGPT Ads (OpenAI Conversions API) destinations | read | --company-id |
productmetrics destinations set-openai | Save ChatGPT Ads (OpenAI Conversions API) destination | setup | --company-id, --property-id, --pixel-id, --enabled |
productmetrics destinations test-openai | Send ChatGPT Ads (OpenAI Conversions API) test event | setup | --company-id, --property-id |
productmetrics destinations delete-openai | Deletes. Delete ChatGPT Ads (OpenAI Conversions API) destination | setup | --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).
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics settings get | Get Product Segmentation settings | read | --property-id |
productmetrics settings recommend-min-clicks | Recommend minimum clicks | read | --property-id |
productmetrics settings preview | Preview Product Segmentation settings | read | --property-id, --body-file |
productmetrics settings preview-strategy | Preview segmentation strategy | read | --property-id, --body-file |
productmetrics settings update | Save Product Segmentation settings | write | --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.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics product-rules list | List product rules | read | --property-id |
productmetrics product-rules get-impact | Get product rules impact | read | --property-id |
productmetrics product-rules preview | Preview product rule conditions | read | --property-id, --when-cols, --when-ops, --when-vals |
productmetrics product-rules create | Create a product rule | write | --property-id, --name, --when-cols, --when-ops, --when-vals, --target-cols, --action, --action-value |
productmetrics product-rules reorder | Reorder product rules | write | --property-id, --rules |
productmetrics product-rules update | Update a product rule | write | --property-id, --rule-id |
productmetrics product-rules toggle | Turn a product rule on or off | write | --property-id, --rule-id |
productmetrics product-rules delete | Deletes. Delete a product rule | write | --property-id, --rule-id, --yes |
Feed
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics feed-source-settings get | Get feed source settings | read | --property-id |
productmetrics feed-source-settings update | Save feed source settings | write | --property-id, --product-segment, --category-priority |
productmetrics feed generate | Generate the feed now | write | --property-id |
Voorraad
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics inventory-settings get | Get inventory planning settings | read | --property-id |
productmetrics inventory-settings update | Save an inventory planning setting | write | --property-id, --store-id, --scope-kind, --lead-time-days, --safety-buffer-days |
productmetrics inventory get-state | Get inventory state | read | --property-id |
Webshopgegevens
De eigen gegevens van de webshop. Bestellingen, Business Health en voorraad vereisen Pro.
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics orders get-availability | Check orders are available | read | |
productmetrics orders list | List orders | read | --company-id, --storefront-scope-id |
productmetrics orders get | Get an order | read | --company-id, --order-id, --storefront-scope-id |
productmetrics store list-shops | List shops | read | --property-id |
productmetrics store get-health-slice | Get Business Health | read | --property-id, --window-days, --compare |
productmetrics store get-health-series | Get Business Health series | read | --property-id, --weeks, --compare |
productmetrics store list-health-products | List Business Health products | read | --property-id, --window-days |
productmetrics analytics get-status | Get analytics status | read | --property-id |
productmetrics data query | Query the lake | read | --property-id, --sql |
productmetrics insights get | Get an insight card | read | --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 10Feedback
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.
| Flag | What it does |
|---|---|
--search <text> | Alleen handelingen waarvan de ID, titel of beschrijving deze tekst bevat |
--scope read|setup|write | Alleen 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> --jsonFlags die elk API-commando neemt
Naast de veldflags neemt elk API-commando deze.
| Flag | What 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-stdin | Read the JSON body from stdin |
--idempotency-key <uuid> | Idempotency-Key header: the same key makes a retry safe |
--auto-idempotency-key | Send 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-secrets | Print fields the API marks as secret instead of hiding them |
--yes | Confirm an operation that deletes data, without a prompt |
--dry-run | Print 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 connectproductmetrics tracking update-margin-policy(required)