# Google Trends: Interest Over Time, by Region & Related Queries (`data-for-agents/google-trends-scraper`) Actor

Google Trends data for a list of keywords in one run: interest over time, interest by region (countries, US states), top and rising related queries, for a country or worldwide. One row per keyword and data type. $0.90 per 1,000 keyword results; failed keywords are free. Compare 2-5 on one scale.

- **URL**: https://apify.com/data-for-agents/google-trends-scraper.md
- **Developed by:** [Data for Agents](https://apify.com/data-for-agents) (community)
- **Categories:** SEO tools
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.90 / 1,000 keyword results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Google Trends: Interest Over Time, by Region & Related Queries

Get Google Trends data for a list of keywords in one run, as structured JSON. No login and no API
key.

You pay per keyword that comes back complete. A keyword that fails costs nothing, and its row tells
you why.

### Price

$0.90 per 1,000 keyword results. One keyword with all three data types counts once. There is no charge per
row, and a keyword that fails or has no data at Google costs nothing.

### Limits and tested numbers

- At most 3,000 keywords per run. Split a longer list into several runs.
- About 7 to 9 minutes per 1,000 keywords. Two keywords take 15 to 35 seconds.
- Tested on Apify: 3,000 of 3,000 keywords answered in one run (26 minutes), and 1,000 of 1,000 in
  another. A request that Google refuses is tried again from a new address, and a keyword that still
  fails is tried once more at the end of the run.
- A run that is interrupted or reaches its time limit continues where it stopped when it is
  resurrected; no keyword is stored or charged twice.

### Questions the input form does not answer

- **Maximum cost:** set "Maximum cost per run" in the run options (API: `maxTotalChargeUsd`). The
  run stops there, charges nothing above it and says how many keywords are left.
- **Duplicates and spaces:** keywords are trimmed and looked up once; a duplicate is not charged twice.
- **Partly failed keyword:** a keyword is charged only when every data type you asked for came
  back. If one type fails, the keyword is free and the rows that did come back are still stored.
- **Wrong country, time range or category:** the run does not start, or ends at once with one free
  `invalid_input` row that names the field. Nothing is charged.
- **Time range values:** `now 1-H` past hour, `now 4-H` past 4 hours, `now 1-d` past day, `now 7-d`
  past 7 days, `today 1-m` past 30 days, `today 3-m` past 90 days, `today 12-m` past 12 months,
  `today 5-y` past 5 years, `all` 2004 to today.
- **One country per run.** For several countries, start one run per country.
- **Speed:** 3,000 keywords take 19 to 26 minutes in one run, because several sessions work side by
  side. The default memory and timeout are enough for that.

### Compare keywords on one scale

Set `compare` to `true` with 2 to 5 keywords and they are sent to Google together, as on Google
Trends' compare view. Then:

- **Interest over time** uses one shared 0-100 scale, so the keywords can be compared with each
  other. Each row's `compare.average` is that keyword's average on the shared scale.
- **Interest by region** keeps each keyword's own 0-100 value per region and adds `share`: the
  keyword's percent among the compared keywords in that region.
- **Related queries** are returned per keyword, as usual.
- Every row has `compare.keywords`, the group it was compared in.

```json
{ "keywords": ["bitcoin", "ethereum"], "compare": true, "country": "US", "timeRange": "today 12-m" }
```

Price is the same: one charge per keyword returned. With `compare` off (the default) each keyword
is looked up on its own and values of different keywords cannot be compared.

### What you get

For every keyword, one row per data type:

- **Interest over time**: the 0-100 search interest series, with a date for every point.
- **Interest by region**: the 0-100 interest for every country (worldwide) or every state or
  province (inside one country), strongest first.
- **Related queries**: the top and the rising searches that people also make, with Google's growth
  figure and a link to each query on Google Trends.

Every row carries the exact parameters that were sent to Google, so a result can be repeated or
audited later.

### Input

- **Keywords**: one per line. Each keyword is looked up on its own.
- **Country**: a two-letter code such as `US`, `GB`, `DE` or `BR`. Leave empty for worldwide. A
  region code such as `US-CA` also works.
- **Time range**: past hour, 4 hours, day, 7 days, 30 days, 90 days, 12 months, 5 years, or 2004 to
  today.
- **Custom time range**: optional, `YYYY-MM-DD YYYY-MM-DD`. Replaces the time range.
- **Category**: optional Google Trends category number, to narrow a keyword with several meanings.
  `0` is all categories.
- **Data to return**: any of the three data types. Fewer types make the run faster.

```json
{
  "keywords": ["bitcoin", "electric cars"],
  "country": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "dataTypes": ["interest_over_time", "interest_by_region", "related_queries"]
}
```

### Output

One row per keyword per data type. `data` holds the series.

```json
{
  "keyword": "bitcoin",
  "data_type": "interest_over_time",
  "status": "ok",
  "error": null,
  "error_code": null,
  "compare": null,
  "count": 53,
  "data": [
    { "date": "2025-11-09T00:00:00+00:00", "value": 40, "is_partial": false },
    { "date": "2025-11-16T00:00:00+00:00", "value": 67, "is_partial": false }
  ],
  "request": { "geo": "US", "time": "today 12-m", "category": 0, "property": "", "hl": "en-US", "tz": 0 },
  "fetched_at": "2026-11-11T09:30:00+00:00"
}
```

`data` for the other two types:

```json
{ "geo_code": "US-WY", "geo_name": "Wyoming", "value": 100 }
```

```json
{ "rank": "top", "query": "bitcoin price", "value": 100, "formatted_value": "100",
  "link": "https://trends.google.com/trends/explore?q=bitcoin+price&date=today+12-m&geo=US" }
```

#### The `status` field

- `ok`: Google returned data.
- `no_data`: Google answered, and it has too few searches to show for this keyword, country and
  time range.
- `error`: the data could not be fetched. `error` says what happened and what to do, and
  `error_code` is one of the codes below. A keyword with an error row is never charged.

A failure is never returned as an empty result.

### Errors

Every error row is free.

| `error_code` | Meaning | Does a retry help? |
|---|---|---|
| `invalid_input` | The input, or this keyword, cannot be used (not text, longer than 100 characters, unknown country or time range, or refused by Google as invalid) | No. Fix the input |
| `rate_limited` | Google refused the request (HTTP 429) on every try | Yes, later |
| `blocked` | Google refused the request (HTTP 403) on every try | Yes, later |
| `timeout` | A request, or the keyword as a whole, took too long | Yes |
| `network_error` | The request did not get through, or Google answered with a server error | Yes |
| `proxy_error` | The proxy gave no session | Yes |
| `site_changed` | Google's answer no longer has the shape this Actor reads | No. The Actor needs an update |
| `not_tried` | Several keywords in a row failed, so the run stopped before this one | Yes, later |
| `low_memory` | The run was close to its memory limit and stopped before this keyword | Yes, with more memory |
| `cost_limit` | Your maximum cost per run was reached | Yes, with a higher limit |
| `run_timeout` | The run stopped a minute before its own time limit | Yes. Resurrect the run or raise the timeout |
| `internal_error` | A fault in the Actor | Yes; please report it |

The run's status message and the `OUTPUT` record give the counts per code. A run always ends as
succeeded, so a scheduled job or an agent never has to handle a failed run: the rows say what went
wrong. `OUTPUT` has `"status"`: `failed` when the input was unusable, no keyword came back or most
were refused; `stopped` when your cost limit or the time limit ended the run before any keyword
came back; `ok` otherwise.

### Good to know

- Values are Google's own 0-100 index. 100 is the peak of that keyword inside the chosen country and
  time range. Because each keyword is looked up on its own, do not compare the values of two
  different keywords.
- In related queries, `rank` is `top` (value 0-100) or `rising` (value is growth in percent).
  `formatted_value` shows `Breakout` for growth above 5,000%.
- The last point of a series can be marked `is_partial`: that period is still running.
- Dates are in UTC. Region names are in English.
- Related topics are not included.
- Keywords run in several paced sessions side by side. A request that Google refuses is tried again
  from a new address.
- If Google refuses several keywords in a row, the run stops early instead of running for hours.
  The keywords that were not tried get an error row and cost nothing.
- Not affiliated with Google.

# Actor input Schema

## `keywords` (type: `array`):

Search terms to look up, one per line. Each keyword is looked up on its own, so its numbers are not scaled against the other keywords.

## `compare` (type: `boolean`):

Off (default): each keyword is looked up on its own, up to 3,000 per run. On: 2 to 5 keywords are compared on one shared 0-100 scale, as on Google Trends' compare view; interest by region also gives each keyword's share per region.

## `country` (type: `string`):

Two-letter country code, for example US, GB, DE or BR. Leave empty for worldwide. A region code such as US-CA also works.

## `timeRange` (type: `string`):

The period to cover. Short ranges give hourly or daily points, long ranges weekly or monthly points.

## `customTimeRange` (type: `string`):

Optional. Start and end date as YYYY-MM-DD YYYY-MM-DD, for example 2024-01-01 2024-12-31. When set, it replaces the time range above.

## `category` (type: `integer`):

Google Trends category number, to narrow a keyword with several meanings. 0 is all categories. Examples: 7 Finance, 5 Computers & Electronics, 45 Health, 71 Food & Drink, 20 Sports.

## `dataTypes` (type: `array`):

Each data type is one output row per keyword. Fewer types make the run faster.

## Actor input object example

```json
{
  "keywords": [
    "bitcoin",
    "electric cars"
  ],
  "compare": false,
  "country": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "dataTypes": [
    "interest_over_time",
    "interest_by_region",
    "related_queries"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

Every row: data rows (status ok or no_data) and free error rows (status error).

## `summary` (type: `string`):

Counts: keywords returned, with no data, failed and not tried, and error rows by error_code.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "bitcoin",
        "electric cars"
    ],
    "country": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-for-agents/google-trends-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": [
        "bitcoin",
        "electric cars",
    ],
    "country": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("data-for-agents/google-trends-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "bitcoin",
    "electric cars"
  ],
  "country": "US"
}' |
apify call data-for-agents/google-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-for-agents/google-trends-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7vds2X1UocgF1IOyo/builds/ch3PEpHTcBLQ3kcuo/openapi.json
