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

Google Trends data without the failed runs: interest over time, interest by region, related queries and topics, and trending searches. Careful rate handling with backoff and session rotation. Every keyword gets a row, with data or a clear error code.

- **URL**: https://apify.com/clearpipe/google-trends-scraper.md
- **Developed by:** [ClearPipe Data](https://apify.com/clearpipe) (community)
- **Categories:** SEO tools, Marketing, Developer tools
- **Features:** Limited permissions
- **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/actors/running/actors-in-store.md#pay-per-usage

## 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, by region, related queries, trending searches

Get Google Trends data for any keyword, read from the same data endpoints trends.google.com uses: **interest over time**, **interest by region**, **related queries** (top and rising), **related topics**, and today's **trending searches**. Use the output in spreadsheets, dashboards, SEO and market research. This Actor depends on website data endpoints that Google can change or block. For Trending Now, an empty country setting uses the US feed; keyword interest can be worldwide.

**Documented outcomes for processed keywords.** The actor spaces requests and retries temporary Google errors. Each processed keyword returns data or an error code such as `RATE_LIMITED` or `UPSTREAM_ERROR`. A spending limit can stop the run before all keywords are processed. Storage failures, unexpected errors or interrupted runs can also leave incomplete output; check the run status as well as the dataset.

### What you can do with it

- **SEO and content planning.** Explore rising queries around a topic and compare search interest between keyword ideas.
- **Market and product research.** Track relative search interest in a product, brand or category over months or years; these values do not measure sales or predict future demand.
- **Regional targeting.** See which countries, or which states and regions within a country, search for something most.
- **Trend monitoring.** Schedule a daily run with **Trending now** turned on to collect what a country is searching for today, with approximate search volume and news links.
- **YouTube, News, Images and Shopping search.** Measure interest on those searches instead of web search.

### Input

| Field | What it does |
|---|---|
| **Search terms** | One keyword per line. |
| **Compare keywords together** | Off (default): each keyword is run on its own, so its values are scaled 0-100 against itself. On: keywords are compared in groups of up to 5, like the comparison view on trends.google.com, and values are relative to the most-searched keyword in the group. |
| **Country or region** | ISO code, for example `US`, `GB`, `DE`, or a region such as `US-CA`. Empty = worldwide. |
| **Time range** | Past hour, 4 hours, day, 7 days, 30 days, 90 days, 12 months, 5 years, or 2004 to present. |
| **Custom time range** | Any range as `YYYY-MM-DD YYYY-MM-DD`, for example `2024-01-01 2024-12-31`. |
| **Category ID** | A Google Trends category, `0` = all. |
| **Search type** | Web, YouTube, News, Images or Google Shopping search. |
| **Interest over time / by region / Related queries / Related topics** | Choose what to collect. All are on by default except **Related topics**, which Google often returns empty for automated requests. |
| **Trending now** | Also return the current trending searches for the country. With no search terms, only trending searches are returned. An empty country setting uses the US feed, not worldwide trends. |
| **Max retries per request** | How hard to retry when Google rate-limits (default 4). |
| **Proxy** | Apify Proxy by default. |

Example input:

```json
{
  "searchTerms": ["python", "javascript"],
  "geo": "US",
  "timeRange": "today 3-m",
  "includeTimeseries": true,
  "includeByRegion": true,
  "includeRelatedQueries": true,
  "trendingNow": true
}
```

### Output

One row per processed keyword. Example keyword row (lists shortened):

```json
{
  "type": "keyword",
  "status": "ok",
  "keyword": "python",
  "geo": "US",
  "timeRange": "today 3-m",
  "category": 0,
  "property": "",
  "timeline": [
    {"date": "2026-07-11T00:00:00+00:00", "value": 76, "isPartial": false},
    {"date": "2026-10-11T00:00:00+00:00", "value": 28, "isPartial": true}
  ],
  "byRegion": [
    {"geoCode": "US-KS", "geoName": "Kansas", "value": 100},
    {"geoCode": "US-DC", "geoName": "District of Columbia", "value": 52}
  ],
  "relatedQueries": {
    "top": [{"query": "python code", "value": 100, "formattedValue": "100", "link": "https://trends.google.com/trends/explore?q=python+code&date=today+3-m&geo=US"}],
    "rising": [{"query": "tom rahill everglades python hunt", "value": 4200, "formattedValue": "+4,200%", "link": "https://trends.google.com/trends/explore?q=tom+rahill+everglades+python+hunt&date=today+3-m&geo=US"}]
  },
  "relatedTopics": null,
  "warnings": [],
  "scrapedAt": "2026-10-11T00:56:29.200373+00:00"
}
```

- **timeline**: Google's 0-100 interest score per hour, day or week (the step depends on the time range). `isPartial: true` marks the latest point, which is still being collected.
- **byRegion**: 0-100 interest per country (worldwide) or per region (when you set a country).
- **relatedQueries / relatedTopics**: `top` is ranked 0-100. `rising` values are % growth; `Breakout` means very large growth.
- **warnings**: anything the row is missing and why. A part that failed is `null`; a part Google had nothing for is an empty list.

With **Trending now**, one row per trending search:

```json
{
  "type": "trending",
  "status": "ok",
  "geo": "US",
  "rank": 1,
  "title": "will venable",
  "approxTraffic": "1000+",
  "publishedAt": "2026-10-11T00:40:00+00:00",
  "picture": "https://encrypted-tbn0.gstatic.com/images?q=...",
  "pictureSource": "On3",
  "newsItems": [{"title": "...", "url": "https://...", "source": "...", "snippet": null, "picture": "https://..."}]
}
```

Google's trending feed is per country. With worldwide selected, the US feed is used.

### Error codes

Expected source failures produce an error row for the affected keyword. Keywords not reached before a spending limit or interrupted run may be absent:

| errorCode | Meaning |
|---|---|
| `RATE_LIMITED` | Google kept answering HTTP 429 after all retries and session changes. Re-run those keywords later, or raise **Max retries**. |
| `UPSTREAM_ERROR` | Google Trends returned a server error (5xx) on every attempt. |
| `NETWORK` | Connection failures on every attempt. |
| `BAD_REQUEST` | Google rejected the request. Check the keyword, country code, category and time range. |
| `BAD_RESPONSE` | Google answered with something that isn't Trends data. |
| `TOKEN_REJECTED` | Google rejected the data request twice, even after a fresh lookup. Re-run the keyword. |
| `INTERNAL` | An unexpected error in the actor. It attempts to save these rows for remaining keywords, then fails the run. A storage failure can prevent those rows from being saved. |

Wrong input (for example a country code like `USA`, or a malformed custom range) stops the run at the start with a clear message, before any requests are made.

A keyword with too little search volume returns `status: "ok"` with an empty timeline and a warning saying so. That is Google's answer, not a failure.

### Verification examples

On 2026-10-11, a live check for `python` and `javascript` in the US over the past 90 days returned 93 daily points per keyword using five requests, with no HTTP 429 or 5xx responses. This small sample is not a sustained-load benchmark or an availability guarantee.

Offline fixtures exercise exhausted retries, server errors and rejected widget tokens. Separate Linux checks cover saving before event charging and stopping at the event budget, using synthetic source responses. They do not establish real customer billing or uninterrupted operation.

### How it handles Google's rate limits

- Requests are spaced out instead of fired in bursts.
- On HTTP 429 or a server error it waits 2, 4, 8, 16 seconds (with random jitter) and tries again.
- After two rate limits in a row it starts a fresh session: new cookies and, with Apify Proxy, a new IP.
- When the retries run out, the keyword gets an error row and the run carries on with the next keyword.

It reads Google Trends' own data endpoints over plain HTTP, with no browser, so runs do not require a browser. Proxy usage may add cost.

### Pricing

**Free during launch.** You only pay Apify's normal platform usage for your runs. The proposed event model charges for saved keyword rows with `status: "ok"`, including a valid low-volume response with an empty timeline. Check the published pricing before running the actor.

The paid event is `keyword`: one successful keyword result, saved before charging.
Error rows and Trending Now RSS entries do not trigger that event. The Actor stops
processing additional keywords when the event spending limit is reached. Published pricing determines whether event fees apply; check the current Actor pricing before running it.

### FAQ

**Why are my numbers 0-100 and not search counts?** Google Trends only publishes relative interest (100 = the peak in the selected time and place), never absolute search volume. Trending searches include Google's approximate traffic band, such as `1000+`.

**Why do values change when I compare keywords?** With **Compare keywords together** on, all keywords in a group share one scale, so the most-searched one sets 100. Run them separately to get each keyword's own 0-100 curve.

**Why are related topics empty?** Google often returns an empty related-topics list for automated requests, so this option is off by default. Google also doesn't provide related topics for compared keywords at all. The row's `warnings` field tells you which happened. Related queries are not affected.

**Can I use it from code, Make, Zapier or n8n?** Yes. Use the Apify API, the Python or JavaScript client, or any Apify integration.

### Support

Open an issue on the actor's **Issues** tab. Include the run ID and non-sensitive input details to help reproduce the problem.

# Actor input Schema

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

One keyword per line. Each keyword is run on its own unless you turn on Compare keywords together.

## `compareTogether` (type: `boolean`):

Run keywords in groups of up to 5, like the comparison view on trends.google.com. Values are then relative to the most-searched keyword in the group. Google does not provide related topics for compared keywords.

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

ISO code such as US, GB, DE or a subregion such as US-CA. Leave empty for worldwide.

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

A preset, or a custom range typed as 'YYYY-MM-DD YYYY-MM-DD' (for example 2024-01-01 2024-12-31).

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

Overrides Time range. Format: YYYY-MM-DD YYYY-MM-DD.

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

Google Trends category ID, for example 5 = Computers & Electronics, 71 = Food & Drink. 0 = all categories.

## `property` (type: `string`):

Which Google search to measure.

## `includeTimeseries` (type: `boolean`):

The 0-100 interest timeline.

## `includeByRegion` (type: `boolean`):

0-100 interest per country (worldwide) or per subregion (when a country is set).

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

Top and rising related searches.

## `includeRelatedTopics` (type: `boolean`):

Top and rising related topics. Off by default: Google often returns this list empty for automated requests. When it does, the row says so in warnings. Related queries are not affected.

## `trendingNow` (type: `boolean`):

Also output the current trending searches for the country (from Google Trends' Trending Now feed), with approximate traffic and news links. With no search terms, only trending searches are returned. Worldwide uses US.

## `maxRetries` (type: `integer`):

Retries on rate limits (HTTP 429) and server errors, with growing waits (2, 4, 8, 16 s...) and a fresh session after repeated rate limits.

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

Apify Proxy is used by default. Each fresh session gets a new proxy IP.

## Actor input object example

```json
{
  "searchTerms": [
    "python",
    "javascript"
  ],
  "compareTogether": false,
  "geo": "",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "web",
  "includeTimeseries": true,
  "includeByRegion": true,
  "includeRelatedQueries": true,
  "includeRelatedTopics": false,
  "trendingNow": false,
  "maxRetries": 4,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One row per keyword (data or an error code), plus one row per trending search when Trending now is on.

## `resultsFull` (type: `string`):

Every field.

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

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

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

```

## MCP server setup

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