Befehle der CLI
Jede Befehlsgruppe von productmetrics mit ihren Befehlen, dem Scope, den jeder braucht, und den wichtigsten Flags, dazu productmetrics capabilities und productmetrics call.
productmetrics hat einen Befehl pro Operation der öffentlichen API, gruppiert nach dem Teil vor dem Punkt in ihrer Capability-ID.
Wo Sie im Onboarding stehen, und wie es weitergeht.
Der Einrichtungsstatus und der nächste offene Schritt.
Properties, Workspaces, Checkout, Einladungen und Werbeausgaben.
Google-Zugriff, Konten, Conversion-Aktionen und Kundenlisten.
Merchant Center verbinden und seine automatische Einrichtung anwenden.
Einen Shop verbinden und prüfen, ob Käufe ankommen.
Meta Conversions API und ChatGPT Ads (OpenAI Conversions API).
Einstellungen von Product Segmentation: lesen, Vorschau, speichern.
Regeln, die Segmente oder Prioritäten überschreiben.
Einstellungen der Feed-Quelle und das Erzeugen des Feeds.
Einstellungen der Bestandsplanung und Lagerstatus.
Bestellungen, Business Health, Analysen und Datenabfragen.
Einen Befehl finden
Die aktuelle Liste kommt immer vom Server:
# alle Operationen: Befehl, Scope, ob sie Daten ändert
productmetrics capabilities
productmetrics capabilities --search "merchant center"
productmetrics capabilities --scope write --json
# eine Gruppe
productmetrics <group> --help
# ein Befehl: Request, Scope, alle Flags, ein Beispiel
productmetrics <group> <command> --helpSo lesen Sie die Tabellen
- Command ist
productmetrics <group> <command>.productmetrics call <capability-id>führt dieselbe Operation aus:productmetrics call google_ads.list_accountsistproductmetrics google-ads list-accounts. - What it does verlinkt die Seite der Operation in der API-Referenz, mit jedem Feld.
- Scope ist der eine Scope, den Ihre Anmeldung braucht. Siehe Authentifizierung.
- Must pass listet die Flags, ohne die der Befehl fehlschlägt: seine Pflichtfelder in Pfad, Query und Body sowie
--body-file,--if-match,--auto-idempotency-keyoder--yes, wo die Operation sie braucht. Alle anderen Flags stehen inproductmetrics <group> <command> --help. - Mit Deletes markierte Befehle lassen sich nicht rückgängig machen. In einem Terminal bittet
productmetricsSie, statt--yesdie ID einzutippen.
IDs stammen aus früheren Ergebnissen, nie aus Vermutungen: property_id und company_id aus productmetrics whoami, Installations-, Verbindungs- und Scope-IDs aus productmetrics tracking get-configuration, Regel-IDs aus productmetrics product-rules list.
Onboarding
Wo Sie im Onboarding von Product Metrics stehen, und wie es weitergeht.
| 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 |
Einrichtung
| Command | What it does | Scope | Must pass |
|---|---|---|---|
productmetrics setup get-status | Get setup status | read |
Die Antwort enthält journey_stage, user.google_grant, hub.company.next_action und hub.property.next_action.
Workspaces und Abrechnung
| 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 nimmt die eingeladenen Personen als JSON in --invitees (oder den ganzen Body in --body). Jede Rolle ist admin, editor oder viewer:
productmetrics invitations send \
--company-id <company_id> \
--invitees '[{ "email": "anna@example.com", "role": "editor" }]'Google Ads
Google-Zugriff gewähren, Google-Ads-Konten verbinden (das legt Properties an), Conversion-Aktionen und Kundenlisten.
| 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 |
Shops und Tracking
Einen Shop verbinden und prüfen, ob Käufe ankommen.
| 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 antwortet je nach Plattform:
| Plattform | Antwort | Exit-Code |
|---|---|---|
| Shopify | mode: redirect und eine authorizationUrl zum Genehmigen im Shopify-Admin | 4, next_action.type: "browser" |
WooCommerce, Shopware 6 (--store-url) | mode: plugin_claim und ein einmaliges Setup-Token, das vor claim.expiresAt in das Product-Metrics-Plugin eingefügt wird | 4, next_action.type: "store_plugin" |
Lightspeed C-Series (--cluster, --shop-domain, --shop-id, --api-key, --api-secret) | mode: provisioning: Die Verbindung wird eingerichtet |
Übergeben Sie auch --auto-idempotency-key, damit eine Wiederholung keine zweite Verbindung startet. stores connect und stores create-woocommerce-setup-claim verbergen das Setup-Token, es sei denn, Sie übergeben --show-secrets. Danach zeigt productmetrics tracking get-commerce-configuration, wie die Verbindung aktiv wird.
Ein WooCommerce-Shop mit Plugin 1.0.12 oder neuer sendet beim Koppeln sein Land und seine Währung. Für jeden anderen Shop setzen Sie sie mit tracking update-scope-dimensions vor tracking update-margin-policy: Die Standard-Margenkosten (marginDefaultCatalog in tracking get-configuration) brauchen genau ein Land und eine Währung pro Shop-Scope.
Destinations
Destinations für die Meta Conversions API und die OpenAI Conversions API (ChatGPT Ads), eine pro 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 |
Einstellungen
Einstellungen von Product Segmentation: lesen, eine empfohlene Mindestzahl an Klicks abrufen, einen Entwurf in der Vorschau ansehen, speichern. Jeder Befehl nimmt --feed-scope (eine Feed-ID oder 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>"'Produktregeln
Regeln, die Segmente oder Prioritäten für die Produkte überschreiben, auf die sie zutreffen. Jeder Befehl nimmt --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 |
Lagerbestand
| 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 |
Shopdaten
Die eigenen Daten des Shops. Bestellungen, Business Health und Lagerbestand brauchen 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 sendet Feedback über feedback.send (Scope read) an das Team von Product Metrics. Es ist kein Support-Kanal; lassen Sie personenbezogene Daten weg. Die Nachricht kann das Argument oder --message sein; --about <capability-id> füllt --context und --feature, und --request-id fügt die Request-ID eines fehlgeschlagenen Aufrufs hinzu.
productmetrics feedback \
--sentiment negative \
--about settings.update \
--request-id <request_id> \
--message "The save answered 500 twice."Capabilities und call
productmetrics capabilities listet jede Operation, die der Server anbietet, mit dem Befehl, der sie ausführt, ihrem Scope und ob sie Daten ändert. Mit --json hat jeder Eintrag außerdem command, secret_fields und browser_step.
| Flag | Was es tut |
|---|---|
--search <text> | Nur Operationen, deren ID, Titel oder Beschreibung diesen Text enthält |
--scope read|setup|write | Nur Operationen, die diesen Scope brauchen |
productmetrics call <capability-id> führt eine Operation über ihre ID aus (mit _ oder -), mit denselben Feld-Flags wie der generierte Befehl:
productmetrics call google_ads.list_accounts
productmetrics call settings.get --param propertyId=<property_id> --jsonFlags, die jeder API-Befehl nimmt
Neben seinen Feld-Flags nimmt jeder API-Befehl diese.
| 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 |
Nur diese Befehle nehmen einen Idempotency-Key; bei jedem anderen ist --auto-idempotency-key oder --idempotency-key ein Verwendungsfehler (Exit-Code 2):
productmetrics companies create(required)productmetrics stores connectproductmetrics tracking update-margin-policy(required)