# Google Trends API: Compare Keywords, Regions & Related Queries (`2eightnine/google-trends-api`) Actor

Google Trends data without the failed runs. Get interest over time, interest by region and related queries for any keyword and country. Compare up to 5 keywords on one scale. Pay only for keywords that return data.

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

## Pricing

from $4.00 / 1,000 keyword delivereds

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 API: Compare Keywords, Regions & Related Queries

Get Google Trends data for any list of keywords as clean JSON, CSV or Excel. One record per keyword, with interest over time, interest by region and related queries.

**You pay only for keywords that return usable data.** Failed keywords and keywords with no search interest are free.

### What you get

- **Interest over time**: the 0–100 trend line for each keyword, with the average and a flag on the still-incomplete current period
- **Interest by region**: by country, sub-region, city or US metro area
- **Related queries**: top and rising searches for each keyword
- **Keyword comparison**: up to 5 keywords scored against each other on one shared scale, like the Trends compare page
- **Any location**: every country code Google Trends supports (US, GB, KR, TW, ID, ...) and sub-regions such as US-CA
- **Any time range**: past day to 5 years, all time, or custom dates
- **Web, image, news, YouTube and Shopping search**

### Why this one

- **No charge for empty or failed results.** A keyword is billed only when at least 3 periods have search interest. If Google blocks a keyword through every retry, you are not charged for it.
- **Built to get past blocks.** Each parallel worker uses its own proxy address and Google session. A blocked or stalled request moves to a fresh address and retries, and anything still failing gets a second pass at the end of the run.
- **Fast.** In our tests, 20 keywords with city-level regions and related queries finished in about 20 seconds.
- **Complete records.** Regions and related queries are included by default, not as paid extras.

### Input

| Field | Default | Notes |
| --- | --- | --- |
| `keywords` | required | List of search terms |
| `compare` | `false` | On: score keywords against each other in groups of up to 5. Off: each keyword on its own 0–100 scale |
| `geo` | worldwide | `US`, `GB`, `KR`, `US-CA`, ... |
| `timeRange` | `today 12-m` | `now 1-d`, `now 7-d`, `today 1-m`, `today 3-m`, `today 5-y`, `all`, or `2025-01-01 2025-12-31` |
| `searchType` | `web` | `web`, `images`, `news`, `youtube`, `shopping` |
| `category` | `0` | Google Trends category number; 0 is all categories |
| `includeRegions` | `true` | |
| `regionResolution` | Google's default | `COUNTRY`, `REGION`, `CITY`, `DMA` |
| `includeRelatedQueries` | `true` | |
| `includeRelatedTopics` | `false` | See limits below |
| `maxConcurrency` | `3` | Keywords fetched in parallel, 1 to 5 |
| `proxyConfiguration` | Residential | Residential proxies are strongly recommended; Google blocks most datacenter addresses |

#### Example: one country, several keywords

```json
{
  "keywords": ["air fryer", "instant pot", "slow cooker"],
  "geo": "US",
  "timeRange": "today 12-m"
}
```

#### Example: compare keywords on one scale

```json
{
  "keywords": ["netflix", "disney plus", "hulu", "max", "paramount plus"],
  "compare": true,
  "timeRange": "today 5-y"
}
```

### Output

One dataset item per keyword:

```json
{
  "keyword": "electric car",
  "geo": "US",
  "timeRange": "today 12-m",
  "average": 38,
  "hasData": true,
  "dataPoints": 53,
  "charged": true,
  "comparedWith": ["hybrid car"],
  "interestOverTime": [
    { "time": "2025-11-23T00:00:00.000Z", "formattedTime": "Nov 23 – 29, 2025", "value": 23, "isPartial": false }
  ],
  "interestByRegion": [
    { "geoCode": "US-WY", "geoName": "Wyoming", "value": 100 }
  ],
  "relatedQueries": {
    "top": [{ "query": "best electric car", "value": 100, "formattedValue": "100" }],
    "rising": [{ "query": "electric car battery degradation comparison", "value": 3100, "formattedValue": "+3,100%" }]
  },
  "comparison": {
    "keywords": ["electric car", "hybrid car"],
    "averages": { "electric car": 38, "hybrid car": 23 }
  }
}
```

`comparison` appears only when `compare` is on. It also carries the shared time series and a region table with every compared keyword side by side.

### Pricing

Pay per keyword delivered. You are charged once for each keyword that returns usable data, plus Apify's standard small fee for starting a run. You pay nothing for:

- keywords with no search interest, or fewer than 3 periods of it
- keywords that fail after all retries

Every record has a `charged` field, so you can see exactly what you paid for. If you set a maximum charge for a run, the Actor stops when it is reached.

### Limits to know about

- **Values are relative, not search volumes.** Google Trends reports a 0–100 index. This Actor does not estimate search volume.
- **Comparisons work in groups of 5.** That is Google's limit. With more than 5 keywords and `compare` on, keywords are split into groups, and scores are comparable within a group but not across groups. To compare more than 5, include one shared keyword in every run and rescale against it.
- **Rare keywords are noisy.** Google samples its data, so a very low-volume keyword can show a small blip on one request and nothing on the next.
- **Related topics are currently empty.** Google has been returning empty related-topics lists, so the option is off by default. Related queries are unaffected.
- **No official API.** Google Trends has no public API. This Actor reads the same data the Trends website loads, so Google can change it without notice. If something breaks, open an issue and it will be looked at quickly.

### For developers

```bash
npm install
npm test        # offline tests
npm run live    # real request to Google Trends from your own connection
```

# Actor input Schema

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

Search terms to look up. One result per keyword.

## `compare` (type: `boolean`):

On: keywords are scored against each other in groups of up to 5, as on the Google Trends compare page. Off: each keyword gets its own 0-100 scale.

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

Country code such as US, GB, KR, TW or ID, or a sub-region such as US-CA. Leave empty for worldwide.

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

Google Trends time range. Examples: "now 1-d", "now 7-d", "today 1-m", "today 3-m", "today 12-m", "today 5-y", "all", or two dates such as "2025-01-01 2025-12-31".

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

Which Google property to measure.

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

Google Trends category number. 0 means all categories.

## `includeRegions` (type: `boolean`):

Return interest by region for each keyword.

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

Level of detail for interest by region. Leave unset for Google's default for the chosen location.

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

Return top and rising related queries for each keyword.

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

Google has been returning empty related-topics lists, so this is off by default.

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

Interface language for names and labels, such as en-US or de-DE.

## `timezoneOffsetMinutes` (type: `integer`):

Minutes behind UTC, as Google Trends expects it. 0 is UTC, 300 is US Eastern.

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

How many times to retry a request that Google blocks or fails before giving up on that keyword.

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

How many keywords (or comparison groups) to fetch at the same time, each on its own proxy address. Higher is faster but more likely to be blocked by Google.

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

Google blocks most datacenter addresses. Residential proxies are recommended.

## Actor input object example

```json
{
  "keywords": [
    "electric car",
    "hybrid car"
  ],
  "compare": false,
  "timeRange": "today 12-m",
  "searchType": "web",
  "category": 0,
  "includeRegions": true,
  "includeRelatedQueries": true,
  "includeRelatedTopics": false,
  "language": "en-US",
  "timezoneOffsetMinutes": 0,
  "maxRetries": 4,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One item per keyword with interest over time, interest by region and related queries. The `charged` field shows whether the keyword was billed.

## `summary` (type: `string`):

Counts of delivered and empty keywords, and the list of keywords that failed.

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

// Run the Actor and wait for it to finish
const run = await client.actor("2eightnine/google-trends-api").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": [
        "electric car",
        "hybrid car",
    ],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("2eightnine/google-trends-api").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": [
    "electric car",
    "hybrid car"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call 2eightnine/google-trends-api --silent --output-dataset

```

## MCP server setup

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

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/uSipnrEN4mVICdWMI/builds/yg2SpnVXZQzR7yTVf/openapi.json
