# Google Trends Scraper: Interest, Regions & Related Queries (`kasbahdata/google-trends-scraper`) Actor

Get Google Trends data for any keyword, country and time range: interest over time, interest by region or metro, related and rising queries, side-by-side comparisons of up to 5 terms, and today's trending searches with news. Fast, reliable, pay per search term.

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

## Pricing

from $3.00 / 1,000 search terms

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 Scraper: interest over time, regions, related queries

Get **Google Trends** data for any keyword, country and time range, as clean JSON you can drop into a
spreadsheet, a dashboard or an AI agent:

- **Interest over time**: the 0–100 timeline Google Trends shows, from the past hour up to 2004–present, plus each term's **average** and **peak**.
- **Interest by region**: per country (worldwide), or per state/region or **metro area** inside a country.
- **Related queries**: top and **rising** searches, with growth such as `+250%` or `Breakout`.
- **Comparisons**: up to 5 terms on the same scale, exactly like the Trends website.
- **Trending now**: today's trending searches in any country, with approximate search volume, start time and the news articles behind them.

Works for **web, image, news, YouTube and Google Shopping** search, any category, and any language.

### Why this one

- **Reliable.** It handles Google's session cookies and rate limits for you, rotating IPs and retrying automatically, so runs don't die on "429 Too Many Requests".
- **Fast.** Dozens of terms per minute.
- **One clean item per term.** Timeline, regions and related queries for a term come together, with no stitching across datasets.
- **Pay only for what you get.** Failed terms are never charged.

### Input

| Field | Description |
|---|---|
| **Search terms** | One per line. Put up to 5 on one line, separated by commas, to compare them: `python, javascript, rust`. |
| **Country or region** | `US`, `GB`, `FR`, `MA`… or a sub-region like `US-CA`. Empty = worldwide. |
| **Time range** | Past hour, 4 hours, day, 7 days, 30 days, 90 days, 12 months, 5 years, or 2004–present. |
| **Custom time range** | Any period, e.g. `2024-01-01 2024-12-31`. |
| **Search type** | Web, images, news, YouTube or Google Shopping. |
| **Category ID** | Narrow a term's meaning, e.g. `71` Food & Drink, `5` Computers & Electronics. |
| **Interest over time / by region / related queries** | Turn each part on or off. |
| **Region breakdown** | Regions/states or metro areas (US DMAs, French départements…). |
| **Trending now: countries** | Also collect today's trending searches for these countries. |
| **Language** | Language of Google's labels and region names (`en-US`, `fr`, `ar`…). |

### Output

One item per search term (or comparison). Example, shortened:

```json
{
  "type": "comparison",
  "searchTerms": ["python", "javascript"],
  "geo": "US",
  "timeRange": "today 12-m",
  "googleTrendsUrl": "https://trends.google.com/trends/explore?q=python%2Cjavascript&date=today+12-m&geo=US&hl=en-US",
  "interestOverTime": [
    { "date": "2025-11-02T00:00:00Z", "formattedTime": "Nov 2 – 8, 2025", "values": { "python": 67, "javascript": 10 }, "isPartial": false }
  ],
  "averageInterest": { "python": 61, "javascript": 9 },
  "peak": { "python": { "date": "2026-06-14T00:00:00Z", "formattedTime": "Jun 14 – 20, 2026", "value": 100 } },
  "interestByRegion": [
    { "geoCode": "US-KS", "geoName": "Kansas", "values": { "python": 84, "javascript": 16 } }
  ],
  "regionResolution": "REGION",
  "relatedQueries": {
    "python": {
      "top": [{ "query": "what is python", "value": 100, "trendsUrl": "https://trends.google.com/trends/explore?q=what+is+python..." }],
      "rising": [{ "query": "python swallowing deer india", "value": 5000, "growth": "Breakout", "trendsUrl": "..." }]
    }
  },
  "scrapedAt": "2026-11-07T19:10:00Z"
}
```

Trending searches come as separate items:

```json
{
  "type": "trendingSearch",
  "geo": "US",
  "rank": 1,
  "title": "dana white",
  "approxTraffic": "500+",
  "approxTrafficMin": 500,
  "startedAt": "2026-11-07T18:40:00Z",
  "news": [{ "title": "...", "url": "https://...", "source": "Yahoo Sports" }]
}
```

Values are Google's relative interest (0–100, where 100 is the peak within your selection), not
absolute search volumes. The dataset has two ready-made views, **Search terms** and **Trending now**,
and exports to JSON, CSV, Excel and more.

### Use it from your code

Use it as a **Google Trends API**, a maintained **pytrends alternative** that handles the cookies and 429 rate limits for you:

**Python** (`pip install apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("kasbahdata/google-trends-scraper").call(run_input={
    "searchTerms": [
        "python, javascript"
    ],
    "geo": "US",
    "timeRange": "today 12-m"
})
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)
```

**JavaScript** (`npm install apify-client`)

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('kasbahdata/google-trends-scraper').call({
    "searchTerms": [
        "python, javascript"
    ],
    "geo": "US",
    "timeRange": "today 12-m"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**HTTP** (one request, waits for the results)

```bash
curl -X POST "https://api.apify.com/v2/acts/kasbahdata~google-trends-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["python, javascript"], "geo": "US", "timeRange": "today 12-m"}'
```

Your token is under **Settings → API & Integrations** in Apify Console. The Actor also works in Make, Zapier, n8n
and from AI agents through the Apify MCP server.

### Pricing

Pay per event, no subscription:

| Event | Price |
|---|---|
| Search term (timeline + regions + related queries) | **$0.003** ($3 per 1,000 terms) |
| Trending search | **$0.0005** ($0.50 per 1,000) |
| Actor start | $0.00005 per run (Apify default) |

A comparison of 3 terms counts as 3 search terms. Terms that fail are not charged. Set a **maximum
cost per run** and the Actor stops cleanly when it's reached.

### Good to know

- **Related topics** are not included: Google currently returns them empty through its API.
- **City-level** breakdown is no longer offered by Google; use **metro areas** instead.
- Very rare terms may have no data for short time ranges or small countries; you'll get empty arrays, not an error.

### FAQ

**Do I need proxies or a Google account?** No. Everything runs on Apify; the default Apify Proxy works well.

**Can I track terms over time?** Yes. Schedule the Actor daily or weekly in Apify and compare runs.

**Can I use it from AI agents?** Yes. It works with the Apify MCP server, LangChain, Make, Zapier and n8n through Apify's integrations.

Questions or a missing feature? Open an issue on the **Issues** tab. I usually reply within a day.
If the Actor saved you time, a short review on the Actor page helps other people find it.

# Actor input Schema

## `searchTerms` (type: `array`):

One search term per line. To compare terms side by side (on the same 0-100 scale, like on the Google Trends website), put up to 5 on one line separated by commas, e.g. "python, javascript, rust".

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

Two-letter country code (US, GB, FR, MA, DE...) or a sub-region code like US-CA or FR-75. Leave empty for worldwide.

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

Period to analyse. Short ranges return hourly or minute-level data; long ranges return weekly or monthly data.

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

Overrides the time range above. Format: "YYYY-MM-DD YYYY-MM-DD", e.g. "2024-01-01 2024-12-31".

## `searchType` (type: `string`):

Which Google property to measure: web search, images, news, YouTube or Google Shopping.

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

Google Trends category to narrow the meaning of a term (e.g. 0 = all, 5 = Computers & Electronics, 71 = Food & Drink, 7 = Finance). Default: all categories.

## `includeInterestOverTime` (type: `boolean`):

Timeline of interest (0-100), plus the average and the peak for each term.

## `includeInterestByRegion` (type: `boolean`):

Interest (0-100) per country (worldwide) or per region / metro area (inside a country).

## `regionResolution` (type: `string`):

Inside a country: regions (states, provinces) or metro areas (US DMAs, French départements...). Falls back to regions where Google has no metro data. Worldwide always uses countries.

## `includeRelatedQueries` (type: `boolean`):

Top and rising related searches for each term (rising ones include growth such as "+250%" or "Breakout").

## `trendingNowGeos` (type: `array`):

Also get what's trending right now in these countries (two-letter codes, e.g. US, GB, MA). Each trending search comes with approximate search volume, start time and related news articles.

## `language` (type: `string`):

Language for Google's labels and region names, e.g. en-US, fr, de, ar.

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

Apify Proxy (datacenter) works well for Google Trends and is the default. Switch to residential only if you see repeated errors.

## Actor input object example

```json
{
  "searchTerms": [
    "chatgpt",
    "python, javascript"
  ],
  "geo": "US",
  "timeRange": "today 12-m",
  "searchType": "",
  "category": 0,
  "includeInterestOverTime": true,
  "includeInterestByRegion": true,
  "regionResolution": "AUTO",
  "includeRelatedQueries": true,
  "language": "en-US",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "searchTerms": [
        "chatgpt",
        "python, javascript"
    ],
    "geo": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("kasbahdata/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 = {
    "searchTerms": [
        "chatgpt",
        "python, javascript",
    ],
    "geo": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("kasbahdata/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 '{
  "searchTerms": [
    "chatgpt",
    "python, javascript"
  ],
  "geo": "US"
}' |
apify call kasbahdata/google-trends-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kasbahdata/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/rBd5MZLNr488jhKKx/builds/YwDVNYIAzkMGYxbbM/openapi.json
