# Google Trends Scraper - Reliable, Pay Only for Results (`dariandanciu/google-trends-scraper`) Actor

Get Google Trends interest over time, interest by region, related queries, related topics and daily trending searches. Rotates sessions on rate limits, so runs finish instead of failing. Failed terms are never charged.

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

## Pricing

from $0.50 / 1,000 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 - reliable, pay only for results

Get Google Trends data as clean JSON, CSV or Excel - **interest over time, interest by region,
related queries, related topics, and today's trending searches** - for any keyword, country and
time range. Built for runs that finish.

### Why this one

- **Runs finish.** Google rate-limits Trends hard. When it does, this Actor drops the session,
  takes a fresh proxy IP and cookie, backs off, and tries again - up to 15 times per term.
- **You never pay for failures.** Only successful results are charged. If a term still fails after
  every retry, it is listed in the run's `RUN_SUMMARY` record and costs nothing.
- **Flat, analysis-ready rows.** One row per data point, with the keyword, location and time range
  on every row. No nested arrays to unpack before it fits in a spreadsheet.
- **Every row links back to Google.** `searchUrl` opens the exact same chart on trends.google.com,
  so you can spot-check any number.
- **Pick only the data you need** and pay for nothing else.

### What you can get

| Data | One row per | Key fields |
|---|---|---|
| Interest over time | keyword x time point | `date`, `value` (0-100), `isPartial` |
| Interest by region | keyword x region | `geoCode`, `geoName`, `value` |
| Related queries | query (top + rising) | `query`, `value`, `formattedValue` (`+250%`, `Breakout`), `isBreakout` |
| Related topics | topic (top + rising) | `topicTitle`, `topicType`, `value` |
| Trending now | trending search | `title`, `approxTraffic`, `news[]` (headline, url, source) |

Related topics only appear when Google returns them for that term; Google currently leaves the
list empty for many searches.

### How to use it

1. Add one or more **search terms**.
2. Optional: set a **location** (`US`, `GB`, `US-CA`; empty = worldwide), a **time range**, a
   **category**, or a **search type** (web, image, news, shopping, YouTube).
3. Turn on **Compare terms** to chart terms against each other like `a, b, c` on Google Trends
   (up to 5 per group; longer lists are split into groups of 5).
4. Run it. Download the dataset as JSON, CSV, Excel, or pull it through the API.

For daily trending searches, switch **Mode** to *Trending now* and list country codes.

#### Example input

```json
{
    "searchTerms": ["python", "rust", "golang"],
    "compareTerms": true,
    "geo": "US",
    "timeRange": "today 12-m",
    "dataTypes": ["interestOverTime", "relatedQueries"]
}
```

#### Example output row

```json
{
    "type": "interestOverTime",
    "keyword": "python",
    "geo": "US",
    "timeRange": "today 12-m",
    "date": "2025-10-26T00:00:00.000Z",
    "formattedTime": "Oct 26 - Nov 1, 2025",
    "value": 60,
    "isPartial": false,
    "searchUrl": "https://trends.google.com/trends/explore?q=python%2Crust%2Cgolang&date=today+12-m&geo=US"
}
```

### Good to know

- **Values are relative, not search counts.** 100 is the peak for that chart. Values from separate
  runs are only comparable when the terms were compared in the same group.
- **`isPartial: true`** marks the current, unfinished period. It will still change.
- **Custom dates:** `YYYY-MM-DD YYYY-MM-DD`. Google picks the granularity (hourly to monthly) from
  the span.
- **Proxy:** keep Apify Proxy on. Without it, large runs from one IP get throttled.

### Pricing

Pay per result. Runs, retries and failed terms are free. See the Pricing tab for the current rate.

### Use it from code

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

Works with Zapier, Make, n8n, Google Sheets, and as an MCP tool for AI agents through Apify's integrations.

### Is scraping Google Trends legal?

This Actor collects public, aggregated, anonymous search-interest data shown on trends.google.com.
It collects no personal data. You are responsible for how you use the results; check Google's terms
for your use case.

### Feedback

Found a bug or need a field? Open an issue on the Issues tab. Fixes usually ship within a few days.

# Actor input Schema

## `mode` (type: `string`):

Explore: trends for your search terms. Trending: today's trending searches for one or more countries.

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

Keywords to look up. Each is scraped separately unless 'Compare terms' is on.

## `compareTerms` (type: `boolean`):

Put terms on one chart, like typing 'a, b' into Google Trends. Values become relative to each other. Groups of up to 5 (Google's limit).

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

Country or region code, e.g. US, GB, US-CA. Leave empty for worldwide.

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

How far back to look. Google picks the granularity (minutes to months) from the span.

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

Overrides Time range. Format: YYYY-MM-DD YYYY-MM-DD, e.g. 2024-01-01 2024-12-31.

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

Google Trends category, 0 = all. E.g. 5 = Computers & Electronics, 7 = Finance, 71 = Food & Drink.

## `property` (type: `string`):

Which Google search to measure, same as the dropdown on trends.google.com.

## `dataTypes` (type: `array`):

Pick only what you need - you pay per result.

## `trendingGeos` (type: `array`):

Only for Trending mode. Country codes, e.g. US, GB, DE, IN.

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

Language for topic names and labels, e.g. en-US, de, fr.

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

Each retry uses a fresh proxy session.

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

Google rate-limits single IPs fast. Apify Proxy is strongly recommended.

## Actor input object example

```json
{
  "mode": "explore",
  "searchTerms": [
    "web scraping",
    "data analysis"
  ],
  "compareTerms": false,
  "geo": "",
  "timeRange": "today 12-m",
  "category": 0,
  "property": "web",
  "dataTypes": [
    "interestOverTime",
    "interestByRegion",
    "relatedQueries",
    "relatedTopics"
  ],
  "trendingGeos": [
    "US"
  ],
  "language": "en-US",
  "maxRetries": 6,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Every Google Trends row from this run.

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

Result count and any inputs that failed (failed inputs are not charged).

# 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": [
        "web scraping",
        "data analysis"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dariandanciu/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": [
        "web scraping",
        "data analysis",
    ] }

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

```

## MCP server setup

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