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

Google Trends by keyword: interest over time, peak, rising or falling, top regions, and rising and top related searches.

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

## Pricing

from $2.50 / 1,000 keyword trends

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

Google Trends by keyword: interest over time, peak, rising or falling, top regions, and rising and top related searches.

For SEO teams, marketers, product researchers, and analysts who need demand data they can sort and chart. Every run tells you plainly what worked and what did not: no silent empty runs.

### What you can do with it

- **Trend spotting:** sort by `trendDirection` and `changePercent` to see which keywords are growing.
- **Keyword research:** `risingQueries` shows breakout searches before they are crowded; `topQueries` shows the steady ones.
- **Seasonality:** chart `timeline` over 5 years to plan launches, stock, and ad spend.
- **Market sizing by place:** `topRegions` shows where interest is highest, by country or by state.

### What you get

| Field | What it is | Example |
| --- | --- | --- |
| `keyword` | The keyword you submitted. | electric car |
| `type` | trend or error. | trend |
| `geo` | Country code, or Worldwide. | US |
| `timeRange` | The time range used. | past_12_months |
| `dateFrom` | First date of the series (YYYY-MM-DD). | 2025-10-19 |
| `dateTo` | Last date of the series (YYYY-MM-DD). | 2026-10-18 |
| `searchType` | web, youtube, news, images, or shopping. | web |
| `averageInterest` | Average interest over the period (0–100). | 37.6 |
| `peakInterest` | Highest interest value (100 unless the period is very flat). | 100 |
| `peakDate` | Start date of the period with the peak. | 2026-04-12 |
| `latestInterest` | Most recent value. The last period may still be in progress. | 18 |
| `trendDirection` | rising, falling, or flat: the last quarter of the series vs the first quarter (±15%). | rising |
| `changePercent` | Percent change from the first quarter of the series to the last quarter. | 19.6 |
| `timeline` | Interest over time: date (YYYY-MM-DD start of the period), Google's label, and value 0–100. | \[{"date": "2025-10-19", "label": "Oct 19 – 25, 202…, …] |
| `topRegions` | Regions with interest, highest first (code, name, value 0–100). | \[{"code": "US-WY", "name": "Wyoming", "value": 100}, …] |
| `risingQueries` | Related searches that grew the most: growth as shown ("Breakout" or "+850%") and growthPercent. | \[{"query": "smart car", "growth": "+600%", "growth…, …] |
| `topQueries` | Most popular related searches with a 0–100 score. | \[{"query": "best electric car", "score": 100}, …] |
| `relatedTopics` | Related topics when Google shows them. Often empty. |  |
| `trendsUrl` | Opens the same view on trends.google.com. | https://trends.google.com/trends/explore?q=electric+car\&geo=US |

Examples come from a real run. Every row has every field; a value the page did not show is `null`, never guessed.

One row per keyword with the full timeline, regions, and related searches inside.

### How to use it

1. Click **Try for free** (or **Start**) on this page.
2. Enter one keyword per line in the first field. The form is prefilled with a working example.
3. Optional: set **Max results** and the other options.
4. Click **Start**. Open the **Output** tab, or export JSON, CSV, Excel, or HTML.

#### Example input

```json
{
  "keywords": [
    "electric car"
  ],
  "geo": "US"
}
```

#### Example output

One real row from a run on 23 October 2026 (long values shortened here):

```json
{
  "keyword": "electric car",
  "type": "trend",
  "geo": "US",
  "timeRange": "past_12_months",
  "dateFrom": "2025-10-19",
  "dateTo": "2026-10-18",
  "searchType": "web",
  "averageInterest": 37.6,
  "peakInterest": 100,
  "peakDate": "2026-04-12",
  "latestInterest": 18,
  "trendDirection": "rising",
  "changePercent": 19.6,
  "timeline": [
    {
      "date": "2025-10-19",
      "label": "Oct 19 – 25, 2025",
      "value": 16
    },
    {
      "date": "2025-10-26",
      "label": "Oct 26 – Nov 1, 2025",
      "value": 16
    },
    {
      "date": "2025-11-02",
      "label": "Nov 2 – 8, 2025",
      "value": 19
    },
    "…"
  ],
  "topRegions": [
    {
      "code": "US-WY",
      "name": "Wyoming",
      "value": 100
    },
    {
      "code": "US-OR",
      "name": "Oregon",
      "value": 23
    },
    {
      "code": "US-VT",
      "name": "Vermont",
      "value": 22
    },
    "…"
  ],
  "risingQueries": [
    {
      "query": "smart car",
      "growth": "+600%",
      "growthPercent": 600
    },
    {
      "query": "electric car rental near me",
      "growth": "+400%",
      "growthPercent": 400
    },
    {
      "query": "xiaomi backed electric sports car",
      "growth": "+300%",
      "growthPercent": 300
    },
    "…"
  ],
  "topQueries": [
    {
      "query": "best electric car",
      "score": 100
    },
    {
      "query": "electric cars",
      "score": 73
    },
    {
      "query": "new electric car",
      "score": 73
    },
    "…"
  ],
  "relatedTopics": [],
  "trendsUrl": "https://trends.google.com/trends/explore?q=electric+car&geo=US"
}
```

### Pricing

Pay per result: **$2.50 per 1,000 rows**, plus **$0.001** per run start. No subscription.

| Event | When | Price |
| --- | --- | --- |
| Actor start | Once per run (per GB of memory; the default 256 MB counts as one) | $0.001 |
| Result row | Each row saved to the dataset | $0.0025 |

| Example | Rows | Cost |
| --- | --- | --- |
| 10 keywords | 10 | $0.001 + $0.025 = **$0.026** |
| 100 keywords | 100 | $0.001 + $0.25 = **$0.251** |
| 1,000 keywords | 1,000 | $0.001 + $2.50 = **$2.501** |

- Retries after a bot check or a temporary error cost you nothing. You pay only for rows saved.
- An input that fails after all retries saves one error row (one row charge), so you can see what failed and why.
- Set **Max total charge per run** in the run options. The Actor stops cleanly at that limit and keeps every row saved so far.

### What you can count on

- **Same columns on every row.** Missing values are `null`, so spreadsheets and databases never break.
- **No silent failures.** An input that fails gets an error row with `errorCode` and a plain-language `errorMessage`. The other inputs keep running.
- **A clear run summary.** The run status says how many results were saved, how many inputs failed, and why. The same numbers are saved as the `RUN_SUMMARY` record in the run's key-value store, for automations.
- **Automatic retries.** Bot checks and temporary errors are retried with a fresh request before an input counts as failed.
- **Limits respected.** **Max results** and your spending limit stop the run cleanly.

### Use it from code, automations, and AI agents

**API** (returns the rows when the run finishes):

```bash
curl -X POST "https://api.apify.com/v2/acts/datacortex~google-trends-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"keywords": ["electric car"], "geo": "US"}'
```

**Python** (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("datacortex/google-trends-scraper").call(run_input={"keywords": ["electric car"], "geo": "US"})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row)
```

**JavaScript** (`npm install apify-client`):

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('datacortex/google-trends-scraper').call({"keywords": ["electric car"], "geo": "US"});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**No-code:** connect the Actor in Make, Zapier, n8n, or Google Sheets through Apify's integrations, or add a webhook to get notified when a run finishes.

**AI agents (MCP):** add `https://mcp.apify.com?tools=datacortex/google-trends-scraper` to Claude, Cursor, or any MCP client. The agent can call this Actor as a tool with the same input as above.

### Limitations

- Values are 0–100, relative to the keyword's own peak in the chosen place and time. They are not search counts.
- Each keyword is measured on its own, so values of two keywords are not on the same scale.
- Keywords with very little search volume get an error row with `no_trend_data`.
- `trendDirection` compares the last quarter of the series with the first quarter. The latest period can still be in progress.
- Related topics are often empty; related searches are almost always filled.

### FAQ

**Which countries work?**
Any two-letter country code, such as `US`, `GB`, `IN`, `DE`, or `BR`. Leave **Country** empty for worldwide.

**Can I measure YouTube or Google Shopping searches?**
Yes. Set **Search type** to YouTube, News, Images, or Google Shopping.

**How do I open the same chart on Google?**
Each row has `trendsUrl`, which opens the same keyword, place, and dates on trends.google.com.

**What does an error row mean?**
It marks an input that failed after retries. `errorCode` is short (`blocked`, `empty_result`, `not_available`, `http_404`, or `invalid_...` for a bad ID or URL) and `errorMessage` says what to do. Remove error rows with a filter on `type`.

**Can I run it on a schedule?**
Yes. Create a task with your input in Apify Console, then add a schedule (for example every day at 8:00).

**Is it legal to collect this data?**
The Actor reads public pages that anyone can open without logging in. You are responsible for how you use the data, including copyright, personal data rules such as GDPR, and the site's terms. If you are not sure, ask a lawyer.

### Related Actors

- [Google Search Scraper](https://apify.com/datacortex/google-search-scraper): Google search results as rows.
- [Google News Scraper](https://apify.com/datacortex/google-news-scraper): Google News results by keyword.
- [YouTube Search Scraper](https://apify.com/datacortex/youtube-search-scraper): YouTube search results by keyword.

### Support

Found a problem or need a field? Open an issue on the **Issues** tab. Include the run ID and one input that shows the problem. We read every issue.

# Changelog

This Actor's version history is a separate document: https://apify.com/datacortex/google-trends-scraper/changelog.md

# Actor input Schema

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

One search term per line. Each keyword is looked up on its own (values are 0–100 relative to that keyword's own peak).

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

Two-letter country code such as `US`, `GB`, `IN`, or `DE`. Leave empty for worldwide.

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

Period to chart. Choose **Custom** to use the dates below.

## `dateFrom` (type: `string`):

Used only when Time range is Custom. Format `YYYY-MM-DD`.

## `dateTo` (type: `string`):

Used only when Time range is Custom. Format `YYYY-MM-DD`. Empty means today.

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

Which Google search to measure.

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

Add `topRegions`: interest by country (worldwide) or by state/region (one country).

## `maxResults` (type: `integer`):

Stop after this many dataset rows. Leave empty to keep every keyword.

## Actor input object example

```json
{
  "keywords": [
    "electric car"
  ],
  "timeRange": "past_12_months",
  "searchType": "web",
  "includeRegions": true
}
```

# Actor output Schema

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

Dataset of Google Trends rows.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datacortex/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": ["electric car"] }

# Run the Actor and wait for it to finish
run = client.actor("datacortex/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": [
    "electric car"
  ]
}' |
apify call datacortex/google-trends-scraper --silent --output-dataset

```

## MCP server setup

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