Developer Guide

Google Ads API for Shopping: Metrics, Segments & Developer Guide

Last updated: February 2026 - 18 min read
Samuli Kesseli
Samuli Kesseli

Senior MarTech Consultant

Build custom Shopping analytics with the Google Ads API. This guide covers product-level queries, Shopping-specific segments, key metrics, API version management, and practical code examples.

Deep Dive Articles

Explore specific topics in detail:

Google Ads API Overview

The Google Ads API lets you programmatically manage Google Ads accounts, including Shopping campaigns. For Shopping specifically, it's the only way to get detailed product-level performance data that isn't available in the UI.

API ecosystem architecture diagram showing how external applications connect to Google Ads and Merchant Center data through the Google Ads API, including OAuth authentication, GAQL queries, and data flow
How apps connect to Google Ads and Merchant Center data through the API ecosystem

What You Can Do

API vs Scripts vs UI

Capability API Scripts UI
Product-level metrics Full access Limited Basic only
Custom reporting Full flexibility Moderate Predefined
External integration Yes Limited No
Setup complexity High Medium None

Authentication Setup

The Google Ads API uses OAuth 2.0 for authentication. You'll need:

  1. Google Cloud Project: Create a project in Google Cloud Console
  2. OAuth credentials: Create OAuth 2.0 client ID
  3. Developer token: Apply through Google Ads API Center
  4. Refresh token: Generated during OAuth flow

Configuration File

Most client libraries use a configuration file:

# google-ads.yaml
developer_token: YOUR_DEVELOPER_TOKEN
client_id: YOUR_CLIENT_ID
client_secret: YOUR_CLIENT_SECRET
refresh_token: YOUR_REFRESH_TOKEN
login_customer_id: YOUR_MCC_ID  # Optional, for MCC accounts

Security Note

Never commit credentials to source control. Use environment variables or secure secret management in production.

Querying Shopping Data

The Google Ads Query Language (GAQL) lets you query Shopping performance. For product-level data, use the shopping_performance_view resource.

Data model diagram centered on shopping_performance_view resource showing relationships between segments like product_item_id, product_title, product_brand and metrics like clicks, impressions, cost_micros, conversions
The shopping_performance_view data model with its segments and metrics

Basic Product Performance Query

SELECT
  segments.product_item_id,
  segments.product_title,
  segments.product_brand,
  metrics.impressions,
  metrics.clicks,
  metrics.cost_micros,
  metrics.conversions,
  metrics.conversions_value
FROM shopping_performance_view
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.cost_micros DESC
LIMIT 100

Key Resources for Shopping

Key Shopping Metrics

Common metrics for Shopping analysis:

Cost & Engagement

Conversions

Competitive Metrics

For the complete metrics reference, see our API metrics guide.

Shopping Segments

Segments let you break down data by dimensions. Shopping-specific segments include:

Product Identifiers

Product Categories

Custom Labels

Other Useful Segments

For advanced segmentation techniques, see our Shopping segments guide.

API Versioning

Google releases new API versions regularly. Managing versions is critical for production systems.

Gantt-chart timeline showing Google Ads API version lifecycles from release through sunset, illustrating overlapping support windows for versions v20 through v23
API version lifecycle timeline showing release, deprecation, and sunset phases

Version Lifecycle

Migration Strategy

  1. Monitor the Google Ads API blog for release announcements
  2. Review breaking changes in release notes
  3. Test new version in staging environment
  4. Update client library version
  5. Deploy and monitor for issues

Current Version

As of early 2026, v23 is the latest stable version. Check our v23 update guide for migration details and the official v23 reference for the complete API documentation.

Practical Examples

Python: Get Top Products by Spend

from google.ads.googleads.client import GoogleAdsClient

client = GoogleAdsClient.load_from_storage("google-ads.yaml")
ga_service = client.get_service("GoogleAdsService")

query = """
    SELECT
        segments.product_item_id,
        segments.product_title,
        metrics.cost_micros,
        metrics.conversions,
        metrics.conversions_value
    FROM shopping_performance_view
    WHERE segments.date DURING LAST_30_DAYS
    ORDER BY metrics.cost_micros DESC
    LIMIT 50
"""

response = ga_service.search_stream(
    customer_id="1234567890",
    query=query
)

for batch in response:
    for row in batch.results:
        product_id = row.segments.product_item_id
        cost = row.metrics.cost_micros / 1_000_000
        conversions = row.metrics.conversions
        roas = (row.metrics.conversions_value / cost) if cost > 0 else 0
        print(f"{product_id}: ${cost:.2f} spend, {conversions} conv, {roas:.1f}x ROAS")

Python: Find Zero-Conversion Products

query = """
    SELECT
        segments.product_item_id,
        segments.product_title,
        metrics.cost_micros,
        metrics.clicks
    FROM shopping_performance_view
    WHERE
        segments.date DURING LAST_30_DAYS
        AND metrics.conversions = 0
        AND metrics.cost_micros > 50000000
    ORDER BY metrics.cost_micros DESC
"""

# Products spending >$50 with zero conversions

Python: Product Impression Share

query = """
    SELECT
        segments.product_item_id,
        metrics.search_impression_share,
        metrics.search_budget_lost_impression_share,
        metrics.search_rank_lost_impression_share
    FROM shopping_performance_view
    WHERE segments.date DURING LAST_7_DAYS
    ORDER BY metrics.impressions DESC
    LIMIT 100
"""

# Note: Impression share is a fraction (0.5 = 50%)

API Best Practices

Query Optimization

Rate Limiting

Error Handling

Frequently Asked Questions

How do I get product-level data from the Google Ads API?

Use the shopping_performance_view resource with segments like segments.product_item_id and segments.product_title. Query metrics like metrics.clicks, metrics.impressions, metrics.cost_micros, and metrics.conversions to get product-level performance data.

What's the difference between Google Ads API and Google Ads Scripts?

Google Ads API is a REST/gRPC API for building external applications with full functionality. Google Ads Scripts run JavaScript inside Google Ads with simpler syntax but limited capabilities. Use the API for production applications; use Scripts for quick automations and reports.

How often does the Google Ads API update?

Google releases new API versions approximately quarterly. Each version is supported for about 12 months. You should plan to update your integration at least annually. Monitor the Google Ads API blog and release notes for deprecation notices.

What are Shopping segments in the Google Ads API?

Shopping segments are dimensions that let you slice Shopping campaign data by product attributes. Key segments include product_item_id, product_title, product_brand, product_category_level1-5, product_type_l1-l5, and product_custom_attribute0-4. Use them to get granular product-level reporting.

Build Better Shopping Tools

The Google Ads API unlocks product-level insights that aren't accessible through the UI. Whether you're building automated reporting, bid management, or waste detection, the API provides the data foundation.

Key takeaways:

If you need product-level Shopping analytics without building your own integration, SKU Analyzer handles the API complexity for you—delivering product performance insights through a simple dashboard.

Related Guides

Skip the API Complexity

SKU Analyzer handles the Google Ads API integration for you, delivering product-level Shopping analytics through a simple dashboard—no coding required.

Free during beta. No credit card required.