# Google Trends Scraper (Reliable) (`cleandatatools/google-trends-reliable`) Actor

Google Trends interest over time, by region and related queries for up to 5 keywords per comparison. Retries, session rotation and per-item errors so one bad keyword never fails your run. Pay only for successful results.

- **URL**: https://apify.com/cleandatatools/google-trends-reliable.md
- **Developed by:** [clean datatools](https://apify.com/cleandatatools) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 (Reliable)

Get **interest over time**, **interest by region** and **related queries** from Google Trends for up to 5 keywords per comparison, and as many comparisons as you like in one run.

This Actor is built to finish your run even when Google pushes back:

- **Paced requests** with a configurable delay, so you hit fewer rate limits.
- **Automatic retries** with exponential backoff and jitter on rate limits (HTTP 429) and server errors.
- **Session rotation**: a fresh session (cookie and, with a proxy, a new IP) after every rate limit and every N requests.
- **Per-item errors**: if one comparison fails, the others still finish. Every output item has a `status` and an `error` field, so you can see exactly what failed and why.
- **You only pay for successful results.** Items with `no_data` or `error` are not charged.

### Input

| Field | What it does |
|---|---|
| `keywords` | Up to 5 terms compared with each other, e.g. `["coffee", "tea"]`. |
| `keywordBatches` | Optional: more comparisons, e.g. `[["bitcoin","ethereum"],["yoga"]]`. A comparison can also set its own location and time range: `{"keywords": ["tea"], "geo": "GB", "timeRange": "today 3-m"}`. |
| `dataTypes` | Any of `interest_over_time`, `interest_by_region`, `related_queries`, `related_topics`. |
| `geo` | Country or region code (`US`, `GB`, `US-CA`); empty = worldwide. |
| `timeRange` | Google Trends format: `now 7-d`, `today 3-m`, `today 12-m`, `today 5-y`, `all`, or `2024-01-01 2024-06-30`. |
| `category` | Google Trends category ID (0 = all). |
| `property` | Web (default), images, news, Google Shopping or YouTube search. |
| `proxyConfiguration` | Apify Proxy. Recommended for larger runs; residential is optional. |
| `minDelaySecs`, `maxRetries`, `rotateSessionEvery` | Reliability settings. The defaults are 3 s, 5 retries and 20 requests per session. |

Example:

```json
{
  "keywordBatches": [["coffee", "tea"], ["bitcoin"]],
  "dataTypes": ["interest_over_time", "related_queries"],
  "geo": "US",
  "timeRange": "today 12-m"
}
```

### Output

One item per comparison and data type:

```json
{
  "keywords": ["coffee", "tea"],
  "geo": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "web",
  "dataType": "interest_over_time",
  "status": "ok",
  "error": null,
  "data": [
    { "time": 1762646400, "formattedTime": "Nov 9 – 15, 2025", "values": { "coffee": 72, "tea": 32 }, "isPartial": false }
  ],
  "durationSecs": 9.1
}
```

- `interest_by_region` rows: `geoCode`, `geoName`, `values` per keyword.
- `related_queries` rows: `keyword`, `list` (`top` or `rising`), `query`, `value`, `formattedValue`.
- `related_topics` rows: `keyword`, `list`, `topicTitle`, `topicType`, `topicMid`, `value`.

A run summary (requests, retries, HTTP status counts, items per status) is saved as `RUN_STATS` in the key-value store.

### Limits and good to know

- Values are Google's relative 0–100 index, not absolute search counts.
- Google allows at most 5 keywords per comparison.
- **Related topics:** Google only offers related topics for single-keyword searches. For comparisons, the Actor looks up each keyword on its own, which costs extra requests. In testing (November 2026), Google returned an empty related-topics list even for a single keyword. Such items come back as `no_data` and are not charged.
- Keywords with very little search volume can return `no_data`.
- Google can rate-limit any tool. For larger runs, use Apify Proxy; residential IPs work best.
- Only Google Trends' public JSON endpoints under `/trends/api/` are used. No login is needed.

# Actor input Schema

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

Up to 5 search terms compared against each other, like on the Trends website.

## `keywordBatches` (type: `array`):

A list of comparisons, each a list of up to 5 terms, e.g. \[\["bitcoin","ethereum"],\["yoga"]]. A comparison can also be an object with its own location and time range: {"keywords": \["tea"], "geo": "GB", "timeRange": "today 3-m"}. Each comparison is fetched and reported separately.

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

What to fetch for every comparison.

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

Country or region code, e.g. US, GB, US-CA. Leave empty for worldwide.

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

Same format as Google Trends: 'now 1-H', 'now 4-H', 'now 1-d', 'now 7-d', 'today 1-m', 'today 3-m', 'today 12-m', 'today 5-y', 'all', or a date range 'YYYY-MM-DD YYYY-MM-DD'.

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

Google Trends category ID. 0 = all categories.

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

Which Google search to use.

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

Language for names of regions and topics, e.g. en-US, de, pt-BR.

## `timezoneOffset` (type: `integer`):

Offset from UTC in minutes as Google expects it (e.g. 0 for UTC, 300 for US Eastern winter time).

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

Apify Proxy is recommended for larger runs. Residential proxies are optional and usually more reliable against Google rate limits.

## `minDelaySecs` (type: `number`):

Pacing between requests. Lower is faster but more likely to be rate limited.

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

Retries with exponential backoff and jitter on rate limits (429) and server errors.

## `rotateSessionEvery` (type: `integer`):

Start a fresh session (cookie and proxy IP) after this many API requests. Sessions are also rotated after every 429.

## Actor input object example

```json
{
  "keywords": [
    "coffee",
    "tea"
  ],
  "dataTypes": [
    "interest_over_time"
  ],
  "geo": "",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "",
  "language": "en-US",
  "timezoneOffset": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "minDelaySecs": 3,
  "maxRetries": 5,
  "rotateSessionEvery": 20
}
```

# Actor output Schema

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

All items (one per comparison and data type) with status, error and data rows.

## `runStats` (type: `string`):

Requests, retries, HTTP status counts and items per status.

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

// Run the Actor and wait for it to finish
const run = await client.actor("cleandatatools/google-trends-reliable").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": [
        "coffee",
        "tea",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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

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/zaIL8nhNZZspfz2kp/builds/Dm9yGVVPEbCHLXvxK/openapi.json
