# Google Trends Scraper — Reliable, No Browser (`fernando-data/google-trends-scraper`) Actor

Google Trends data that doesn't fail: interest over time, by region, related queries (top, rising, Breakout) and trending searches with news. Compare up to 5 terms, paste Trends URLs. No browser, smart retries, pay only for searches that return data.

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

## Pricing

from $5.00 / 1,000 search with data

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 — Reliable, No Browser

Get Google Trends data you can actually count on: **interest over time, interest by region, related queries (top and rising, with Breakout flags) and today's trending searches with news**. Compare up to 5 terms, paste Trends URLs, and **pay only for searches that return data**.

### Why this scraper

Google Trends blocks automated traffic fast, and that is why many Trends scrapers hang, loop or finish with no output. This one is built around that problem:

- **Never loops forever.** Every request has a retry limit and every search has a time limit. When the limit is reached, the run moves on and saves what it collected.
- **Fresh IP and cookies on every retry.** A block (HTTP 429) rotates the proxy session instead of hammering the same IP.
- **Partial results instead of lost runs.** If one part of a search fails (say, related queries for one term), you still get the rest, with a clear `errors` list.
- **You are not charged for failed searches.** Only searches that return data count.
- **No browser.** It talks to Google Trends directly, so runs are fast and cheap.
- **Clear input.** Empty lines are ignored, comparisons are just "term1, term2" on one line, and Trends URLs work as they are.

### What you get

| Data | Field |
|---|---|
| Interest over time (one value per term per point, `null` when Google has no data) | `interestOverTime` |
| Average interest per term | `averages` |
| Interest by country / state / metro / city | `interestByRegion` |
| For comparisons: each term's own regional map | `interestByRegionPerTerm` |
| Related queries, top and rising, with `isBreakout` | `relatedQueries` |
| Related topics (optional; Google often returns it empty) | `relatedTopics` |
| Trending now: title, traffic, time, picture and news articles | items with `type: "trendingNow"` |
| Link to open the same view in Google Trends | `exploreUrl` |

### Input examples

**Compare two terms in Brazil over the past 90 days**

```json
{
  "searchTerms": ["coffee, tea"],
  "geo": "BR",
  "timeRange": "past-90-days"
}
```

**Paste a Google Trends URL**

```json
{
  "startUrls": [{ "url": "https://trends.google.com/trends/explore?q=bitcoin&geo=US&date=today%205-y" }]
}
```

**Daily trending searches for three countries**

```json
{
  "trendingNowGeos": ["US", "GB", "BR"]
}
```

### Output example (shortened)

```json
{
  "type": "search",
  "searchTerms": ["coffee", "tea"],
  "geo": "BR",
  "timeRange": "today 3-m",
  "status": "ok",
  "averages": { "coffee": 10, "tea": 6 },
  "interestOverTime": [
    { "date": "2026-08-10T00:00:00.000Z", "label": "Aug 10, 2026", "values": { "coffee": 10, "tea": 7 }, "isPartial": false }
  ],
  "interestByRegion": [
    { "geoCode": "BR-SP", "geoName": "State of São Paulo", "values": { "coffee": 60, "tea": 40 } }
  ],
  "interestByRegionMode": "share-between-terms",
  "relatedQueries": {
    "coffee": {
      "top": [{ "query": "coffee machine", "value": 76, "formattedValue": "76", "isBreakout": false }],
      "rising": [{ "query": "anomalous coffee machine 3", "value": 38550, "formattedValue": "Breakout", "isBreakout": true }]
    }
  },
  "exploreUrl": "https://trends.google.com/trends/explore?q=coffee%2Ctea&date=today+3-m&geo=BR",
  "errors": []
}
```

`status` is `ok`, `partial` (some parts failed, see `errors`) or `failed` (nothing returned, not charged).

### Notes on Google Trends values

- Values are **relative** (0–100), not search volumes. 100 is the peak for the chosen terms, place and time.
- For comparisons, `interestByRegion` shows how searches split between the terms in each region (they add up to 100). Use `interestByRegionPerTerm` for each term's own map.
- `isPartial: true` marks the latest point, which Google is still collecting.

### Pricing

Pay per event:

- **Search with data**: one charge per search line (or URL) that returns data, whatever it includes.
- **Trending item**: one charge per trending search returned.

Failed searches are free. You can cap the cost of any run with the "Max charge" setting in Apify.

### Tips for reliable runs

- Keep the default **Residential** proxy. Datacenter IPs are blocked by Google Trends within a few requests.
- For large lists, keep "Parallel searches" at 2–3. More parallel requests mean more blocks, not more speed.
- Use it from AI agents and automations (MCP, Make, n8n, Zapier): the input is plain and the output is consistent JSON.

### Legal

This Actor reads public, aggregated data from Google Trends. It does not collect personal data. Use the results in line with Google's terms and the laws that apply to you.

# Actor input Schema

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

One search per line. To compare up to 5 terms on the same chart, put them on one line separated by commas, e.g. "coffee, tea". Empty lines are ignored.

## `startUrls` (type: `array`):

Optional. Paste trends.google.com/trends/explore URLs; their terms, country, time range, category and property are used as they are.

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

Two-letter country code (US, BR, DE…) or a region code like US-CA. Leave empty for worldwide. Not used for URLs.

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

Period to analyse. Ignored when custom dates are set.

## `customStartDate` (type: `string`):

Optional, YYYY-MM-DD. Used together with the custom end date instead of the time range.

## `customEndDate` (type: `string`):

Optional, YYYY-MM-DD.

## `searchProperty` (type: `string`):

Which Google search to measure: web, YouTube, News, Images or Shopping.

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

Google Trends category number. 0 means all categories.

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

Breakdown level for interest by region. Leave empty for Google's default.

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

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

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

Relative interest (0-100) for each term over the chosen period.

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

Where each term is most popular, by country, state, metro or city.

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

Top and rising searches related to each term, with Breakout flags.

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

Google often returns this list empty for automated requests, so it is off by default.

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

Also return today's trending searches with related news for these countries (e.g. US, BR, GB).

## `maxTrendingItems` (type: `integer`):

Maximum number of trending searches returned per country.

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

Google Trends blocks datacenter IPs quickly. Residential proxies are strongly recommended.

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

Each retry uses a new IP and a new cookie session.

## `searchTimeoutSecs` (type: `integer`):

A search never runs longer than this. Whatever was collected is still saved.

## `maxConcurrency` (type: `integer`):

How many searches run at the same time. 2-3 is the most reliable.

## `delayBetweenRequestsMs` (type: `integer`):

Short pause between calls to Google, which lowers the chance of blocks.

## Actor input object example

```json
{
  "searchTerms": [
    "coffee",
    "coffee, tea"
  ],
  "geo": "",
  "timeRange": "past-12-months",
  "searchProperty": "web",
  "category": 0,
  "language": "en-US",
  "includeInterestOverTime": true,
  "includeInterestByRegion": true,
  "includeRelatedQueries": true,
  "includeRelatedTopics": false,
  "maxTrendingItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxRetries": 6,
  "searchTimeoutSecs": 180,
  "maxConcurrency": 2,
  "delayBetweenRequestsMs": 1200
}
```

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

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

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

```

## MCP server setup

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