# Google Trends API – Compare Keywords, Regions & Related Queries (`antonio_aleph/google-trends-compare`) Actor

Google Trends Scraper and API: compare up to 5 keywords for the price of one result. Interest over time, by country/region/city and top & rising related queries, any time range and country. Clean JSON, 6-hour cache, failed comparisons cost $0.

- **URL**: https://apify.com/antonio_aleph/google-trends-compare.md
- **Developed by:** [Antonio Aleph](https://apify.com/antonio_aleph) (community)
- **Categories:** SEO tools, Marketing
- **Stats:** 2 total users, 1 monthly users, 86.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 comparison groups

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 Compare** returns Google Trends data as clean JSON: compare **up to 5 keywords per group**, run **several groups at once**, and pick the **time range, country, category and search type** (web, YouTube, news, images, shopping). Optionally add **interest by region** and **top & rising related queries**.

> ▶️ **Try it in one click:** the input form is prefilled with two games (`Genshin Impact`, `Honkai Star Rail`, worldwide, past 12 months, interest over time only). Just press **Start** to get one row per keyword (2 keywords in one comparison group: **$0.003** on the Free plan, less on paid plans), usually within a minute.
> No subscription or setup: you pay once per comparison group of up to 5 keywords delivered with data; failed groups cost $0.

- 📈 Same 0–100 comparison you see on Google Trends, one row per keyword
- 🌍 Worldwide or any country / subregion (`US`, `KR`, `JP`, `US-CA` …), past hour to 2004–present, or exact dates
- ⏱️ Runs stop at a time limit you choose (default 3 minutes); unfinished groups are free. Results are cached for 6 hours
- 💸 **Compare up to 5 keywords for the price of one result.** Failed groups and groups without data cost nothing.
- 🤖 Predictable JSON with English field descriptions, built for AI agents, dashboards and automations
- 🐍 **A pytrends alternative**: the same interest over time, interest by region and related queries, without maintaining your own scraper (see *Coming from pytrends?* below)

> This is an **unofficial tool**. It is not affiliated with, endorsed by, or operated by Google. It uses publicly available Google Trends data.

### Sample output

```json
{
  "status": "ok",
  "requestGroupId": "8f3c2a91d04e-202610091305",
  "keyword": "Honkai Star Rail",
  "comparedWith": ["Genshin Impact", "Zenless Zone Zero"],
  "timeRange": "today 12-m",
  "geo": "WORLDWIDE",
  "category": { "id": 0, "name": "All categories" },
  "searchType": "web",
  "granularity": "week",
  "intervalSeconds": 604800,
  "timezone": "UTC",
  "hasData": true,
  "averageInterest": 19,
  "latestPointIsPartial": true,
  "interestOverTime": [
    { "date": "2026-09-27T00:00Z", "time": 1790467200, "formattedTime": "Sep 27 – Oct 3, 2026", "value": 10, "hasData": true, "isPartial": false },
    { "date": "2026-10-04T00:00Z", "time": 1791072000, "formattedTime": "Oct 4 – 10, 2026", "value": 8, "hasData": true, "isPartial": true }
  ],
  "sectionErrors": null,
  "fromCache": false,
  "fetchedAt": "2026-10-09T13:05:38+00:00",
  "source": "Google Trends (trends.google.com)"
}
```

With **Add interest by region** on, each row also gets `interestByRegion` (e.g. `{"geoCode": "TH", "geoName": "Thailand", "value": 34}`). With **Add related queries** on, it gets `relatedQueries` with `top` and `rising` lists (e.g. `{"query": "how to check pity in honkai star rail", "value": 2050, "formattedValue": "+2,050%"}`).

### How to read the numbers

1. **`value` is not a search count.** It is a relative index from 0 to 100, where 100 is the highest point of the most searched keyword **within that request**.
2. **Only compare rows with the same `requestGroupId`.** Values from different requests are scaled differently. To compare keywords, put them in the same group (up to 5).
3. **0 does not always mean "no searches".** It can mean Google Trends does not have enough data for that time and place.
4. **Values can shift slightly between runs.** Google Trends is based on a sample of searches, so the same request can return slightly different numbers at different times.
5. **The time step changes with the time range** (`granularity`): minutes or hours for short ranges, days for 1–3 months, weeks for 12 months to 5 years, months for 2004–present. All dates are UTC.
6. **The most recent step can be incomplete.** Check `isPartial` on each point, or `latestPointIsPartial` on the row.
7. **Interest by region is relative too:** 0–100 within the chosen keywords, time range and region level.
8. **"Breakout"** in rising related queries means growth of more than 5,000% by Google's definition.
9. **Results can be up to 6 hours old.** Identical requests are served from a cache for 6 hours; check `fromCache` and `fetchedAt`.

### What can you use Google Trends Compare for?

- **Market and product research**: compare brands, products, games or topics and see which one is growing.
- **Localization and launch planning**: find the countries and regions where interest is highest.
- **YouTube, news and shopping trends**: switch `searchType` to measure a specific Google search.
- **SEO and content planning**: collect top and rising related queries for content ideas.
- **Dashboards**: schedule daily or weekly runs with several comparison groups.

### For AI agents

One call answers questions such as:

- "Is search interest in Nintendo Switch 2 rising in Japan this month?"
- "Which is searched more in Korea over the past 12 months: Genshin Impact or Honkai Star Rail?"
- "In which US states is interest in pickleball highest?"
- "What are the rising related searches for 'Steam Deck' on YouTube?"
- "How did interest in electric bikes change in Germany over the past 5 years?"

Each row is self-describing (`requestGroupId`, `granularity`, `timezone`, `latestPointIsPartial`), so an agent can tell which values may be compared and which are still incomplete.

### How to use it

| Input | Example | Notes |
|---|---|---|
| `keywords` | `["minecraft", "roblox"]` | One comparison group of 1–5 terms. Duplicates (any letter case) are merged. |
| `keywordGroups` | `[["PS5", "Xbox Series X"], ["Steam Deck", "ROG Ally"]]` | Extra groups, up to 10 groups per run in total |
| `timeRange` | `"today 12-m"` | `now 1-H`, `now 4-H`, `now 1-d`, `now 7-d`, `today 1-m`, `today 3-m`, `today 12-m` (default), `today 5-y`, `all` |
| `customTimeRange` | `"2025-01-01 2025-12-31"` | Exact dates from 2004-01-01. Overrides `timeRange`. |
| `geo` | `"KR"`, `"US-CA"` | Empty = worldwide |
| `category` | `"8"` (Games) | Google Trends category id. `0` = all categories (default). |
| `searchType` | `"youtube"` | `web` (default), `youtube`, `news`, `images`, `shopping` |
| `interestByRegion` | `true` | Off by default |
| `regionResolution` | `"CITY"` | `COUNTRY`, `REGION`, `CITY`, `DMA` (US metro areas). Default: countries worldwide, regions within a country. |
| `relatedQueries` | `true` | Off by default |
| `maxRunSeconds` | `180` | Time limit for the whole run (default 180 s, 10–3600). See below. |

Example: three consoles in Japan over the past 5 years, YouTube searches, with interest by region:

```json
{
  "keywords": ["PS5", "Nintendo Switch 2", "Xbox Series X"],
  "timeRange": "today 5-y",
  "geo": "JP",
  "searchType": "youtube",
  "interestByRegion": true
}
```

### Coming from pytrends?

pytrends, the popular unofficial Python library, was archived in April 2025 and is no longer maintained. This Actor covers its most used calls:

| pytrends | Google Trends Compare |
|---|---|
| `build_payload(kw_list, timeframe, geo, cat, gprop)` | `keywords`, `timeRange` or `customTimeRange`, `geo`, `category`, `searchType` |
| `interest_over_time()` | Always included: `interestOverTime` (one row per keyword) |
| `interest_by_region(resolution=...)` | `interestByRegion: true`, `regionResolution` |
| `related_queries()` | `relatedQueries: true` (top and rising) |
| One payload per call | Up to 10 comparison groups per run (`keywordGroups`) |

Python example (`pip install apify-client`, version 3 or later):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("antonio_aleph/google-trends-compare").call(run_input={
    "keywords": ["minecraft", "roblox"],
    "timeRange": "today 12-m",
    "geo": "US",
})
for row in client.dataset(run.default_dataset_id).iterate_items():
    if row["status"] == "ok":
        print(row["keyword"], [(p["date"][:10], p["value"]) for p in row["interestOverTime"]][-3:])
    else:
        print(row["keyword"], row["status"], row["sectionErrors"])  # not charged
```

Google can still rate-limit requests (HTTP 429), as it did with pytrends. Here, each request is retried automatically after 10, 30 and 60 seconds, identical requests are served from a 6-hour cache, and groups that still fail are returned with `status: "failed"` and are not charged.

### Pricing

This Actor uses **pay per event** pricing, with no platform usage fee on top. You pay one **Comparison group** for each group of 1 to 5 keywords whose interest-over-time data was delivered: **comparing 5 keywords costs the same as looking up 1**. The price depends on your Apify plan:

| Apify plan | Price per comparison group (1–5 keywords) | 10 groups of 5 keywords |
|---|---|---|
| Free | $0.003 | $0.03 |
| Starter | $0.002 | $0.02 |
| Scale | $0.0015 | $0.015 |
| Business and above | $0.0012 | $0.012 |

Interest by region and related queries are **included at no extra charge** when you turn them on. A group in which no keyword has Google Trends data costs **$0**; keywords without data inside a charged group are delivered at no extra charge.

You are **not charged anything** for:

- a comparison group that Google Trends did not answer after the retries (`status: "failed"`),
- a comparison group that did not finish within `maxRunSeconds` (`status: "timed_out"`),
- groups in which no keyword has data, invalid input, or runs stopped by the safety checks below.

If an optional section (region or related queries) could not be fetched, the row is still delivered with its interest-over-time data and the missing section is listed in `sectionErrors`.

### How long does a run take?

**Data collection stops at `maxRunSeconds` (default: 180 seconds = 3 minutes)**; the whole run takes about 10 seconds more for start-up and saving. You can set it anywhere from 10 to 3,600 seconds.

- A comparison group usually takes **a few seconds**. In our tests, 10 groups of 5 keywords finished in about 1 minute.
- When Google rate-limits, the Actor waits and retries after **10, 30 and 60 seconds**. A rate-limited group can therefore take 1–3 minutes, and with several groups the default 3-minute limit may be reached.
- When the limit is reached, every **finished group is delivered and charged as usual**. The group in progress is stopped, and it and the remaining groups come back as rows with `status: "timed_out"`, **no data and no charge ($0)**. Run them again later, or raise `maxRunSeconds`.
- Turning on related queries adds one Google request per keyword, so those runs take longer.
- If you raise `maxRunSeconds`, keep the run timeout in Run options above it.

**Every keyword you send gets a row with a `status`:**

| `status` | Meaning | Charged |
|---|---|---|
| `ok` | Data delivered | Once per group, when at least one keyword in the group has data |
| `failed` | Google Trends kept rate-limiting this group after 3 retries | No |
| `timed_out` | `maxRunSeconds` was reached before this group finished | No |

### Rate limits and caching

- The Actor does **not** use proxies or rotate IP addresses to get around Google's limits.
- Identical requests (same keywords, time range, country, category and search type) are served from a **6-hour cache**. Cached rows have `fromCache: true` and keep the original `fetchedAt`. The cache is private to this Actor and holds only the request settings and the Google Trends results, never who asked.
- Every run checks Google Trends' robots.txt first and stops, free of charge, if the endpoints it uses are no longer allowed.

### FAQ

**Can I compare more than 5 keywords?**
Google Trends compares at most 5 at a time. Use several groups and keep one shared "anchor" keyword in every group; compare the other keywords relative to the anchor.

**Why did a group fail or time out?**
`failed`: Google kept rate-limiting the request after three retries. `timed_out`: the run reached `maxRunSeconds` first. Neither is charged; please try those groups again a few minutes later, or raise `maxRunSeconds`.

**What does the run status mean if Google blocks everything?**
If no group returned data, the run still ends as *Succeeded* so that you always get one row per keyword explaining what happened: each row has `status: "failed"` or `"timed_out"`, `hasData: false`, no Trends values and the reason in `sectionErrors`. Nothing is charged, and the run's status message starts with "No Google Trends data delivered". In automations, check the `status` of each row (or `charged` in the `OUTPUT` record) rather than the run status alone.

**Found a problem or need another field?**
Please open an issue in the **Issues** tab.

### Data source and attribution

- Source: **Google Trends** (trends.google.com), publicly available. Google Trends data is a normalized, sampled index, not absolute search volume.
- This Actor is an independent, **unofficial** tool and is not affiliated with Google LLC. Its name and icon do not use Google's logo.

# Actor input Schema

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

One comparison group of up to 5 search terms. Values are relative: 100 is the peak of the most searched keyword in this group, in the chosen time and place.

## `keywordGroups` (type: `array`):

Extra comparison groups, each a list of up to 5 keywords, e.g. \[\["PS5", "Xbox Series X"], \["Steam Deck", "ROG Ally"]]. Up to 10 groups per run in total. Values are comparable only within the same group (same requestGroupId).

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

Preset time range. The time step adapts automatically: minutes or hours for short ranges, days, weeks or months for long ones.

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

Exact dates as "YYYY-MM-DD YYYY-MM-DD" (from 2004-01-01). Overrides the preset.

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

Empty = worldwide. Two-letter country code such as "US", "KR", "JP", "TW", or a subregion such as "US-CA".

## `category` (type: `string`):

Limit to a Google Trends category. Via the API you can also pass any other numeric category id.

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

Which Google search to measure.

## `interestByRegion` (type: `boolean`):

Also return interest by country (worldwide) or by region (within a country). Adds one Google request per group, so runs take a little longer. Included at no extra charge.

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

Override the region level. Default: countries when worldwide, regions within a country.

## `relatedQueries` (type: `boolean`):

Also return top and rising related searches. Adds one Google request per keyword, so runs take longer. Included at no extra charge.

## `maxRunSeconds` (type: `integer`):

Time limit for the whole run. When it is reached, finished groups are delivered as usual and unfinished groups are returned as rows with status "timed_out", free of charge. Keep the run timeout (Run options) above this value.

## Actor input object example

```json
{
  "keywords": [
    "Genshin Impact",
    "Honkai Star Rail"
  ],
  "timeRange": "today 12-m",
  "category": "0",
  "searchType": "web",
  "interestByRegion": false,
  "relatedQueries": false,
  "maxRunSeconds": 180
}
```

# Actor output Schema

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

No description

## `summary` (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": [
        "Genshin Impact",
        "Honkai Star Rail"
    ],
    "timeRange": "today 12-m",
    "maxRunSeconds": 180
};

// Run the Actor and wait for it to finish
const run = await client.actor("antonio_aleph/google-trends-compare").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": [
        "Genshin Impact",
        "Honkai Star Rail",
    ],
    "timeRange": "today 12-m",
    "maxRunSeconds": 180,
}

# Run the Actor and wait for it to finish
run = client.actor("antonio_aleph/google-trends-compare").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": [
    "Genshin Impact",
    "Honkai Star Rail"
  ],
  "timeRange": "today 12-m",
  "maxRunSeconds": 180
}' |
apify call antonio_aleph/google-trends-compare --silent --output-dataset

```

## MCP server setup

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

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/3wdoDYAGaC9ooGPvK/builds/60rvBrJRiCQQDHldP/openapi.json
