Skip to content
Run this on autopilot — free
Workflow · Audits

Rank Every Google Shopping Product by ROAS and Flag the Wasted Spend

Time to first output: 10-15 minutes to set up (Claude Code, Python, API keys) plus the build step, then a few minutes per run

What it does?

A Python CLI pulls Shopping and Performance Max product-level data via GoMarble MCP, ranks every product by ROAS, and flags both stars (high ROAS with real spend) and wasted products (spend with no conversions or low ROAS).

What you need

  • Google Ads Customer ID (CID), e.g. 7556164258
  • Anthropic API key
  • GoMarble API key

First, connect Claude Code to your Google Ads account

GoMarble MCP connects Claude Code with your live Google Ads data — Shopping campaigns, Performance Max, product-level metrics — so the script can fetch everything it needs to analyze product performance automatically.

1

Install Claude Code and Python

Download Claude Code (claude.com/download) and Python (python.org/downloads) if you don't have them.

2

Connect your Google Ads account

Go to apps.gomarble.ai, sign up, and connect your Google Ads account in the Integrations page.

3

Get your GoMarble API key

In GoMarble, go to Settings → API Key, copy it and save it somewhere safe.

4

Add GoMarble MCP to Claude Code

Run the command below in your terminal.

claude mcp add --transport http gomarble https://apps.gomarble.ai/mcp-api/mcp --header "Authorization: Bearer <paste your API key>"

Requires terminal access, Claude Code, a Claude account (Pro or Max recommended), and Python installed.

The prompt

Paste this into Claude Code — it will build the shopping_performance.py CLI script for you. Once built, run it with: python shopping_performance.py --google 1234567890 (replace with your Google Ads Customer ID).

Lead-magnet prompt · free

Build a Python CLI script called shopping_performance.py that analyzes Google Shopping product performance using GoMarble MCP.

CLI args: --google 1234567890 (required, Google only)

Use GoMarble MCP call pattern:

ANTHROPIC_API_KEY = ""
GOMARBLE_API_KEY = ""

POST https://api.anthropic.com/v1/messages, anthropic-version: "2023-06-01", anthropic-beta: "mcp-client-2025-04-04"

mcp_servers: [{type: "url", url: "https://apps.gomarble.ai/mcp-api/sse", name: "gomarble", authorization_token: GOMARBLE_API_KEY}]

6-step pipeline:

1. Account + Shopping Campaigns — GAQL for customer details + campaigns WHERE advertising_channel_type IN ('SHOPPING', 'PERFORMANCE_MAX')

2. Product Performance (30d) — GAQL from shopping_performance_view: offer_id, product_title, product_brand, product_type_l1, impressions, clicks, cost, conversions, conversions_value LIMIT 200

3. Weekly Trends — daily product data bucketed into weeks for ROAS trend detection

4. Rankings — ROAS per product. Stars: ROAS > 2x median AND spend > $50. Wasted: spend > $20 AND (conversions = 0 OR ROAS < 0.5). Aggregate by brand and product_type

5. AI Brief — per-product recommendations

6. Output: product_performance.csv, wasted_products.csv, shopping_brief.txt

What you get back

  • Format: Three files, produced by a 6-step pipeline (account & Shopping/PMax campaign data → 30-day product metrics → weekly trends → ROAS rankings with star/wasted flags → AI-written brief → CSV/TXT outputs):
    • product_performance.csv
    • wasted_products.csv
    • shopping_brief.txt
Upgrade

Want this automated?

Run the prompt above every Monday morning automatically. GoMarble Agents don't just deliver the report (Slack / email / in-app) — they can execute the recommended changes directly in your ad account, too. Offload the whole recurring task and stop doing it manually.

Try GoMarble Agents free →

FAQ

Does this cover Performance Max too, or only classic Shopping campaigns?
Both — Step 1's GAQL query filters to advertising_channel_type IN ('SHOPPING', 'PERFORMANCE_MAX').
What counts as a "star" product?
ROAS more than 2x the account median AND spend over $50.
What counts as a "wasted" product?
Spend over $20 with either zero conversions or ROAS below 0.5.
How many products does it analyze per run?
Up to 200 products from shopping_performance_view, ordered by cost descending, over the last 30 days.
How do I run the finished script?
python shopping_performance.py --google 1234567890, replacing the number with your Google Ads Customer ID.
Does it require Meta Ads too?
No — this workflow is Google Ads (Shopping/PMax) only.

Skip the prompt — let GoMarble do this for you.

Sign up, connect your ad accounts, and shopping product performance cli runs on every account, every week, automatically.