# Google Trends Scraper (`serentity/google-trends-scraper`) Actor

Google Trends data for any keyword as JSON: interest over time, interest by region, related queries and topics. Time range, country, category and search type filters, compare up to 5 keywords. Reliable on datacenter and residential proxies.

- **URL**: https://apify.com/serentity/google-trends-scraper.md
- **Developed by:** [Tarik Cerkezovic](https://apify.com/serentity) (community)
- **Categories:** SEO tools, Marketing, News
- **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 keyword 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

Google Trends as structured data, one item per keyword: the interest-over-time series (0 to 100), interest by country, region or city, and the top and rising related queries and topics. The same filters as the Trends explore page: time range (last hour to all time, or custom dates), country or region, category and search type (web, image, news, YouTube, shopping). Compare up to five keywords against each other, or look each one up on its own scale.

Built to be reliable where other Trends scrapers fail: Google rate-limits datacenter IPs hard, so this actor rotates proxy sessions on every rate limit and falls back to residential proxies only when it has to.

### What you get

| Field | Description |
|---|---|
| `keyword`, `comparedWith`, `geo`, `timeRange`, `category`, `searchType` | The query as run |
| `interestOverTime` | Points with `date` (ISO), `formattedTime`, `value` (0 to 100) and `isPartial` |
| `averageValue`, `maxValue`, `latestValue`, `peakDate` | Summary of the series |
| `interestByRegion` | `geoCode`, `geoName`, `value` for each region with data |
| `relatedQueries` | `top` and `rising` lists with `query`, `value`, `formattedValue`, `isBreakout` |
| `relatedTopics` | Same shape with `topic` (`mid`, `title`, `type`) instead of `query`, when enabled |
| `error`, `errorMessage` | Only on failures |

### Sample output

```json
{
  "keyword": "python",
  "geo": "US",
  "timeRange": "today 12-m",
  "category": 0,
  "searchType": "web",
  "interestOverTime": [
    { "date": "2025-11-02T00:00:00.000Z", "formattedTime": "Nov 2 – 8, 2025", "value": 64, "isPartial": false },
    { "date": "2026-11-01T00:00:00.000Z", "formattedTime": "Nov 1 – 7, 2026", "value": 27, "isPartial": true }
  ],
  "averageValue": 58.3,
  "maxValue": 100,
  "latestValue": 27,
  "peakDate": "2026-03-01T00:00:00.000Z",
  "interestByRegion": [{ "geoCode": "US-WY", "geoName": "Wyoming", "value": 100 }],
  "relatedQueries": {
    "top": [{ "query": "what is python", "value": 100, "formattedValue": "100", "isBreakout": false }],
    "rising": [{ "query": "python 3.14", "value": 5000, "formattedValue": "Breakout", "isBreakout": true }]
  },
  "fetchedAt": "2026-11-05T16:40:00.000Z"
}
```

### Input

| Field | Type | Default | What it does |
|---|---|---|---|
| `keywords` | array of strings | required | Terms to look up. |
| `compareKeywords` | boolean | `false` | Look keywords up together in groups of 5 so values are relative to each other. |
| `timeRange` | string | `today 12-m` | `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 `YYYY-MM-DD YYYY-MM-DD`. |
| `geo` | string | `""` (worldwide) | `US`, `US-CA`, `GB`, `DE`... |
| `category` | integer | `0` | Trends category ID. |
| `searchType` | `""`, `images`, `news`, `youtube`, `froogle` | `""` (web) | Which Google property. |
| `includeInterestOverTime`, `includeInterestByRegion`, `includeRelatedQueries`, `includeRelatedTopics` | booleans | on, on, on, off | Which widgets to fetch. Fewer widgets means fewer requests. |
| `regionResolution` | `AUTO`, `COUNTRY`, `REGION`, `CITY`, `DMA` | `AUTO` | Granularity of interest by region. |
| `language` | string | `en-US` | Locale for labels. |
| `maxConcurrency` | integer | `2` | Keyword groups in parallel. Keep it low; Google rate-limits per IP. |
| `proxyConfiguration` | object | Apify datacenter proxy | Proxy for all requests. |
| `residentialFallback` | boolean | `true` | Retry a rate-limited group through residential proxies. |

Minimal input:

```json
{ "keywords": ["ai agents", "chatgpt"], "geo": "US", "timeRange": "today 3-m" }
```

### Errors

| `error` | Meaning | Charged? |
|---|---|---|
| `NO_DATA` | Google has no data for the keyword in that range and geo (too few searches) | no |
| `BLOCKED` | Google rate-limited every proxy session tried | no |
| `FETCH_FAILED` | Network or parsing failure | no |

### Pricing

Pay per event: a small fixed amount per keyword item that returns data, plus Apify platform usage. Error items are free. One keyword with all three default widgets is four small requests.

### Notes

- Values are Google's relative index: 100 is the peak interest in the chosen range and geo. Comparing keywords puts them on one shared scale; looking them up separately gives each its own.
- `isPartial` marks the current, still-incomplete period.
- Interest by region only lists places with data; Google omits low-volume ones.
- Google Trends has no official API. The actor reads the same endpoints the Trends web page uses, which Google changes occasionally; the actor is tested daily.

### Using it from code

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('serentity/google-trends-scraper').call({ keywords: ['ai agents'], geo: 'US', timeRange: 'today 3-m' });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].interestOverTime.map((p) => [p.date, p.value]));
```

### Legal

Google Trends data is public and aggregated; it contains no personal data. Use it in line with Google's terms of service.

# Actor input Schema

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

Search terms to look up, one per line. Each keyword becomes one dataset item.

## `compareKeywords` (type: `boolean`):

When on, keywords are looked up together in groups of up to 5, so their values are relative to each other (100 = the peak of the most popular one), exactly like comparing terms on the Trends page. When off, each keyword is scaled on its own.

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

One of Google's ranges: 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 custom range as two dates: 2025-01-01 2025-06-30.

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

Google geo code: empty for worldwide, US for the United States, US-CA for California, GB, DE, and so on.

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

Google Trends category ID. 0 is all categories. Examples: 5 Computers & Electronics, 7 Finance, 45 Health, 16 News, 20 Sports.

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

Which Google property to measure.

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

The timeline of search interest (0 to 100) for the range.

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

Interest per country, region or city.

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

Granularity of interest by region. AUTO picks what the Trends page shows for the geo (countries for worldwide, regions for a country).

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

Top and rising related queries.

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

Top and rising related topics (Google's knowledge-graph entities).

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

Locale for labels, for example en-US, de-DE, es-ES.

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

Keyword groups processed in parallel. Google Trends rate-limits aggressively; keep it low.

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

Proxy used for the requests. Apify datacenter proxies are used by default.

## `residentialFallback` (type: `boolean`):

If Google Trends rate-limits the datacenter proxy, retry through Apify residential proxies. Only used on a detected block.

## Actor input object example

```json
{
  "keywords": [
    "python",
    "javascript"
  ],
  "compareKeywords": false,
  "timeRange": "today 12-m",
  "geo": "",
  "category": 0,
  "searchType": "",
  "includeInterestOverTime": true,
  "includeInterestByRegion": true,
  "regionResolution": "AUTO",
  "includeRelatedQueries": true,
  "includeRelatedTopics": false,
  "language": "en-US",
  "maxConcurrency": 2,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": 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 = {
    "keywords": [
        "python",
        "javascript"
    ],
    "timeRange": "today 12-m",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

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

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

```

## MCP server setup

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