# Google Trends Scraper — Interest, Geo & Related (`eszetael_lab/google-trends-scraper`) Actor

Scrape Google Trends: interest over time, interest by region, and related queries for any keywords. Clean flat JSON/CSV. Public aggregated data, no login.

- **URL**: https://apify.com/eszetael\_lab/google-trends-scraper.md
- **Developed by:** [Radosław Szal](https://apify.com/eszetael_lab) (community)
- **Categories:** AI, SEO tools, E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Google Trends Scraper — Interest, Regions & Related Queries

> 🔗 Part of the **[Apify actors collection](https://github.com/Eszetael/apify-actors)** — 6 reliable, tested scrapers & data tools.

Export **Google Trends** data as clean, flat JSON / CSV / Excel — three capabilities over
public, aggregated, anonymous data (mostly 0–100 interest indices; see *Reading the values*), no login:

- **interest_over_time** — how popular keyword(s) are over a time range
- **interest_by_region** — how popular keyword(s) are by geography
- **related_queries** — top & rising related searches for a keyword

Every record carries its **query context** (geo, timeframe, category) and a real **ISO-8601
timestamp**, so the output drops straight into a dashboard, a database or an AI agent — no
post-processing.

### Quick start

Set `keywords`, pick a `mode`, run:

```json
{ "mode": "interest_over_time", "keywords": ["bitcoin", "ethereum"], "timeframe": "today 12-m", "geo": "US" }
````

### Input reference

| Field | What it does |
|-------|--------------|
| **mode** | `interest_over_time` · `interest_by_region` · `related_queries` |
| **keywords** | Terms to analyze (**max 200**; extras ignored). For `interest_over_time` / `interest_by_region`, up to 5 share one 0–100 scale per request; more are split into **groups** — values are only comparable *within the same `chunkGroup`* (see Output). `related_queries` queries each keyword on its own. |
| **timeframe** | `today 12-m`, `today 5-y`, `now 7-d`, or `YYYY-MM-DD YYYY-MM-DD`. |
| **geo** | Two-letter country code (`US`, `PL`) — empty = worldwide. |
| **category** | Google Trends category id (`0` = all categories). |
| **maxItems** | Cap on delivered records (`0` = up to the safety limit of 50 000). **Enforced** — a run stops at this many records. |
| **onlyNew** | Emit only records not seen in previous runs with the same input — turns any scrape into a change monitor / alert. |
| **stateKey** | Optional explicit key for the `onlyNew` memory store (else derived from the input). |
| **proxyConfiguration** | Proxy for the requests. **A RESIDENTIAL proxy is strongly recommended** — Google blocks datacenter IPs (HTTP 429), so without one most runs will be rate-limited. |

### Output

Flat records, one per data point. Examples:

```json
{ "mode": "interest_over_time", "keyword": "bitcoin", "timestamp": 1700000000,
  "date": "2023-11-14T22:13:20+00:00", "formattedDate": "Nov 14, 2023", "value": 78,
  "chunkGroup": 0, "geo": "US", "timeframe": "today 12-m", "category": 0 }

{ "mode": "interest_by_region", "keyword": "bitcoin", "geoName": "Poland", "geoCode": "PL",
  "value": 64, "chunkGroup": 0, "geo": "US", "timeframe": "today 12-m", "category": 0 }

{ "mode": "related_queries", "keyword": "bitcoin", "related_query": "bitcoin etf",
  "value": 250, "formattedValue": "+150%", "rank_type": "rising",
  "chunkGroup": 0, "geo": "US", "timeframe": "today 12-m", "category": 0 }
```

**Reading the values:**

- **`value`** for `interest_over_time` / `interest_by_region` and for `rank_type: "top"` is a **0–100** index, comparable **only within the same `chunkGroup`** (Google rescales each group of ≤5 keywords independently).
- For **`rank_type: "rising"`** `value` is a **growth figure that can exceed 100**; `formattedValue` may read `"Breakout"` for very large spikes.

Download from the run's **Dataset** tab as JSON, CSV, Excel, or pull via the Apify API.

### Monitoring (onlyNew)

Set `onlyNew: true` and schedule the run — each run returns only data points unseen since the
previous run with the same input. Wire it to `related_queries` for **rising-trend alerts** on a timer.

### Notes & fair use

- Data is **public, aggregated and anonymous** (interest indices, not personal data). This actor
  uses Google Trends' public endpoints and does **not** log in or bypass access controls.
- Google blocks datacenter IPs — **use a RESIDENTIAL proxy** for reliable runs (see
  `proxyConfiguration`). The actor backs off on HTTP 429 automatically.
- You are responsible for using exported data in line with Google's terms and applicable law.

# Actor input Schema

## `mode` (type: `string`):

What to scrape.

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

Terms to analyze (max 200; extra are ignored). In interest\_over\_time / interest\_by\_region up to 5 keywords share one 0–100 scale per request; more are split into separate groups — see `chunkGroup` in the output, values are only comparable WITHIN the same group. In related\_queries each keyword is queried on its own.

## `timeframe` (type: `string`):

Google Trends time range, e.g. 'today 12-m', 'today 5-y', 'now 7-d', or 'YYYY-MM-DD YYYY-MM-DD'.

## `geo` (type: `string`):

Two-letter country code (e.g. US, PL) or empty for worldwide.

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

Google Trends category id (0 = all categories).

## `maxItems` (type: `integer`):

Cap on delivered records (0 = up to the safety limit of 50000).

## `onlyNew` (type: `boolean`):

Emit only records not seen in previous runs with the same input (monitoring/alerts).

## `stateKey` (type: `string`):

Optional explicit key for the onlyNew memory store. Leave empty to derive from the input.

## `proxyConfiguration` (type: `object`):

Google Trends blocks datacenter IPs (HTTP 429). A RESIDENTIAL Apify proxy is strongly recommended — without it most runs will be rate-limited.

## Actor input object example

```json
{
  "mode": "interest_over_time",
  "keywords": [
    "bitcoin",
    "ethereum"
  ],
  "timeframe": "today 12-m",
  "geo": "",
  "category": 0,
  "maxItems": 10000,
  "onlyNew": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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",
        "ethereum"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("eszetael_lab/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",
        "ethereum",
    ],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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",
    "ethereum"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call eszetael_lab/google-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=eszetael_lab/google-trends-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Google Trends Scraper — Interest, Geo & Related",
        "description": "Scrape Google Trends: interest over time, interest by region, and related queries for any keywords. Clean flat JSON/CSV. Public aggregated data, no login.",
        "version": "0.2",
        "x-build-id": "uI71KhJF1GS1xDohs"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/eszetael_lab~google-trends-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-eszetael_lab-google-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/eszetael_lab~google-trends-scraper/runs": {
            "post": {
                "operationId": "runs-sync-eszetael_lab-google-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/eszetael_lab~google-trends-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-eszetael_lab-google-trends-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "keywords"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "interest_over_time",
                            "interest_by_region",
                            "related_queries"
                        ],
                        "type": "string",
                        "description": "What to scrape.",
                        "default": "interest_over_time"
                    },
                    "keywords": {
                        "title": "Keywords",
                        "maxItems": 200,
                        "type": "array",
                        "description": "Terms to analyze (max 200; extra are ignored). In interest_over_time / interest_by_region up to 5 keywords share one 0–100 scale per request; more are split into separate groups — see `chunkGroup` in the output, values are only comparable WITHIN the same group. In related_queries each keyword is queried on its own.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "timeframe": {
                        "title": "Timeframe",
                        "type": "string",
                        "description": "Google Trends time range, e.g. 'today 12-m', 'today 5-y', 'now 7-d', or 'YYYY-MM-DD YYYY-MM-DD'.",
                        "default": "today 12-m"
                    },
                    "geo": {
                        "title": "Geo",
                        "type": "string",
                        "description": "Two-letter country code (e.g. US, PL) or empty for worldwide.",
                        "default": ""
                    },
                    "category": {
                        "title": "Category",
                        "type": "integer",
                        "description": "Google Trends category id (0 = all categories).",
                        "default": 0
                    },
                    "maxItems": {
                        "title": "Max results",
                        "type": "integer",
                        "description": "Cap on delivered records (0 = up to the safety limit of 50000).",
                        "default": 10000
                    },
                    "onlyNew": {
                        "title": "Only new",
                        "type": "boolean",
                        "description": "Emit only records not seen in previous runs with the same input (monitoring/alerts).",
                        "default": false
                    },
                    "stateKey": {
                        "title": "State key (onlyNew)",
                        "type": "string",
                        "description": "Optional explicit key for the onlyNew memory store. Leave empty to derive from the input."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Google Trends blocks datacenter IPs (HTTP 429). A RESIDENTIAL Apify proxy is strongly recommended — without it most runs will be rate-limited.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
