There are three methods for retrieving entities and reporting data with the Google Ads API.
This guide primarily focuses on streaming data from
GoogleAdsService. Here are high-level distinctions
for the three data retrieval methods:
|Suitable for production code||Yes||Yes||No (for debugging only)|
||Resource specific services (for example,
|Scenario||Fetching objects and reports||Fetching objects and reports||Fetching objects|
||One object (for example,
|Response's fields||Only those specified in the query||Only those specified in the query||All fields populated|
|Daily limits||Daily limits based on access levels||Daily limits based on access levels||1,000 requests per day|
SearchStream versus Search
Search can send multiple paginated
requests to download the entire report,
SearchStream sends a single request
and initiates a persistent connection with the Google Ads API regardless of report size.
SearchStream, data packets start to download immediately with the entire
result cached in a data buffer. Your code can start reading the buffered data
without having to wait for the entire stream to finish.
By eliminating the round-trip network time required to request each individual
page of a
Search response, depending on your app,
SearchStream can offer
improved performance over paging, especially for bigger reports.
Take a report that consists of
100,000 rows for example. The following
table breaks down the accounting differences between the two methods.
|Page size||Not Applicable||10,000 rows per page|
|Number of API requests||1 request||10 requests|
|Number of API responses||1 continuous stream||10 responses|
In general, we recommend
Search for the following reasons.
For single page reports (under 10,000 rows): No significant performance differences between the two methods.
For multiple page reports:
SearchStreamis typically faster since multiple roundtrips are avoided and reading/writing from disk cache is less of a factor.
Daily limits for both methods adhere to the standard limits and access levels of your developer token. A single query or report is counted as one operation regardless of the result being paged or streamed.