Stay organized with collections
Save and categorize content based on your preferences.
This use case summarizes the performance of an account over the last 30 days by
campaign, segmented by device. The query for this report is as follows:
Watch a video walkthrough of a code sample that searches campaigns with metrics
over the last 7 days. This code sample is written in Java, but the process is
similar for all languages.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThis page provides a Google Ads Query Language (GAQL) query to retrieve a 30-day performance summary of an account, segmented by campaign and device.\u003c/p\u003e\n"],["\u003cp\u003eYou can execute this query using the \u003ccode\u003eGoogleAdsService.SearchStream\u003c/code\u003e interface within the Google Ads API.\u003c/p\u003e\n"],["\u003cp\u003eThe page includes a complete HTTP request example, but it's recommended to utilize client libraries for seamless integration within applications.\u003c/p\u003e\n"],["\u003cp\u003eCode samples and a video walkthrough demonstrating campaign searches with metrics are also available for reference.\u003c/p\u003e\n"]]],[],null,["# Common Use Case Example\n\nThis use case summarizes the performance of an account over the last 30 days by\ncampaign, segmented by device. The query for this report is as follows: \n\n SELECT\n campaign.name,\n campaign.status,\n segments.device,\n metrics.impressions,\n metrics.clicks,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros\n FROM campaign\n WHERE segments.date DURING LAST_30_DAYS\n\nTo issue this request, pass this Google Ads Query Language statement to the\n[`GoogleAdsService.SearchStream`](/google-ads/api/reference/rpc/v21/GoogleAdsService/SearchStream)\ninterface.\n| **Key Point:** This example shows the underlying HTTP request only as a teaching method. We encourage you to use one of the [client libraries](#code_samples) to submit requests in your own app.\n\nHTTP request URL\n----------------\n\nThe request consists of an HTTP POST to the Google Ads API server at the following URL: \n\n https://googleads.googleapis.com/v21/customers/{customer_id}/googleAds:searchStream\n\nComplete HTTP request sample\n----------------------------\n\nHere is a complete example of this report definition, enclosed in an HTTP POST\nrequest. \n\n```\nPOST /v21/customers/{customer_id}/googleAds:searchStream HTTP/1.1\nHost: googleads.googleapis.com\nUser-Agent: curl\nContent-Type: application/json\nAccept: application/json\nAuthorization: Bearer [Enter OAuth 2.0 access token here]\ndeveloper-token: [Enter developerToken here]\n\nParameters:\n{\n \"query\" : \"SELECT campaign.name, campaign.status, segments.device,\n metrics.impressions, metrics.clicks, metrics.ctr,\n metrics.average_cpc, metrics.cost_micros\n FROM campaign\n WHERE segments.date DURING LAST_30_DAYS\"\n}\n```\n\nCode samples\n------------\n\nWatch a video walkthrough of a code sample that searches campaigns with metrics\nover the last 7 days. This code sample is written in Java, but the process is\nsimilar for all languages.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]