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

Interest over time (compare up to 5 keywords), interest by region and city, related queries with fake-entry filtering, and trending searches for any country. Pay only for reports that succeed.

- **URL**: https://apify.com/leanpilar/google-trends.md
- **Developed by:** [Lean Pilar](https://apify.com/leanpilar) (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 $5.00 / 1,000 reports

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: interest over time, regions, related queries and trending searches

Get Google Trends data as clean JSON, without a browser. Compare up to 5 keywords, see
where they are searched, find related and rising queries, and pull today's trending
searches for any country. **You only pay for reports that succeed.**

### What you get

| Report | What it contains |
|---|---|
| **Interest over time** | Timeline of relative interest (0-100) for one keyword, or up to 5 keywords on the same scale, plus averages |
| **Interest by region** | Interest per country, region/state, city, or US metro area (DMA) |
| **Related queries** | Top and rising related searches, with Google's fake entries filtered out (see below) |
| **Trending now** | Today's trending searches for a country, with approximate search volume and news links. Works for small markets too, such as Croatia, Serbia, Slovenia and Bosnia |
| **Related topics** | Available as an option, but Google currently hides them from all automated tools. You get a clear `unavailable` status and are not charged |

All reports support any country or region, time ranges from the last hour to 2004
until today (or a custom date range), Google's categories, and web, news, image,
YouTube or Shopping search.

### Why this scraper

- **Reliable.** In our tests, 195 of 195 reports succeeded on the first run, and 200 of 200
  keywords on Apify's standard proxy. If Google starts blocking, the scraper switches to
  residential proxies by itself.
- **Fake related queries removed.** Google labels automated requests and mixes unrelated,
  generic entries into related queries. For "coffee" in the US it added "sports scores today",
  "pet care tips" and "how to cook pasta" as rising searches. This scraper removes suspected
  fakes and lists them separately in `removedSuspectedDecoys`, so nothing is hidden from you.
- **Fair pricing.** One report is a whole timeline, region table or related-queries list,
  not one row. Blocked requests and searches with too little data are free.
- **Never silently empty.** Every record has a `status` and, if something went wrong, a plain
  explanation.

### Pricing

| Event | Price |
|---|---|
| Report (one successful report) | **$5.00 per 1,000** ($0.005 each) |
| Actor start | $0.00005 per run |

Examples: 100 keywords with interest over time and by region = 200 reports = $1.00.
Trending searches for 10 countries = $0.05. Platform usage is included.

Reports with `status` `noData`, `unavailable` or `error` are never charged.

### Input example

```json
{
  "searchTerms": ["coffee", "coffee, tea, matcha"],
  "reports": ["interestOverTime", "interestByRegion", "relatedQueries"],
  "geo": "US",
  "timeframe": "today 12-m",
  "trendingNowCountries": ["US", "HR", "DE"]
}
```

- One search per line. Put up to 5 keywords on one line, separated by commas, to compare them.
- `geo`: a country or region code such as `US`, `HR`, `US-CA`. Empty means worldwide.
- `timeframe`: `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 range like `2024-01-01 2024-12-31`.

### Output examples

Interest over time, three keywords compared:

```json
{
  "reportType": "interestOverTime",
  "query": "coffee, tea, matcha",
  "keywords": ["coffee", "tea", "matcha"],
  "geo": "US",
  "timeframe": "today 12-m",
  "status": "ok",
  "timeline": [
    {"date": "2025-10-19T00:00:00Z", "formattedTime": "Oct 19 – 25, 2025",
     "values": {"coffee": 64, "tea": 33, "matcha": 5}, "isPartial": false}
  ],
  "averages": {"coffee": 77, "tea": 36, "matcha": 6},
  "exploreUrl": "https://trends.google.com/trends/explore?q=coffee%2Ctea%2Cmatcha&date=today+12-m&geo=US"
}
```

Related queries, with suspected fakes moved aside:

```json
{
  "reportType": "relatedQueries",
  "keyword": "coffee",
  "status": "ok",
  "top": [{"query": "coffee near me", "value": 100, "formattedValue": "100"}],
  "rising": [{"query": "coffee shops nearby", "value": 3550, "formattedValue": "+3,550%"}],
  "removedSuspectedDecoys": [
    {"query": "sports scores today", "formattedValue": "Breakout", "list": "rising"}
  ]
}
```

Trending now:

```json
{
  "reportType": "trendingNow",
  "geo": "HR",
  "status": "ok",
  "trends": [
    {"title": "ilija kovtun", "approxTraffic": "200+", "approxTrafficMin": 200,
     "startedAt": "2026-10-25T15:20:00Z",
     "news": [{"title": "Ilija Kovtun donio Hrvatskoj svjetsko srebro...", "source": "Jutarnji list", "url": "https://..."}]}
  ]
}
```

### Good to know

- **Values are relative, not search volumes.** Google Trends scales each report so that the
  highest point is 100. Compare keywords in the same report to get them on the same scale.
- **The fake-entry filter is a best effort.** It removes entries that are on a list of known
  fakes, or that appear for several unrelated keywords in the same run, and only if they
  share no word with your keyword. Set `decoyFilter` to `flag` to keep everything and only
  mark suspects, or `off` to disable it.
- **Related topics** are currently withheld by Google for automated requests.
- **Trending now** is not available for every country. For example, Google has no page for
  Montenegro (ME). You get a clear error and no charge.
- Low-volume keywords return `noData`, free of charge.

### Use with AI agents

Every record is self-contained JSON with a `status` field, and the input works with
plain keyword lists, which makes this scraper easy to call from AI agents through
Apify's MCP server.

### Related tool

Want to see the ads your competitors run for these searches? Try
[Google Ads Transparency Scraper](https://apify.com/leanpilar/google-ads-transparency): every
Google ad of a domain or advertiser, with text, landing URL, video, regions and dates.

### Feedback

Found a keyword that fails or a fake entry that slipped through? Open an issue on the
Issues tab and include the input. We usually fix such issues quickly.

# Actor input Schema

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

One search per line. To compare keywords on the same 0-100 scale, put up to 5 on one line separated by commas, e.g. "coffee, tea, matcha".

## `reports` (type: `array`):

Which reports to get for each search. Each successful report is one charged result.

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

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

## `timeframe` (type: `string`):

One of: 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 like "2024-01-01 2024-12-31".

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

Google Trends category ID (0 = all categories). Example: 71 = Food & Drink.

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

Which Google search to measure.

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

For Interest by region. Default: countries for worldwide, regions (states) for a country. DMA = US metro areas only.

## `includeLowVolumeRegions` (type: `boolean`):

Also return regions where Google has too little data (marked lowVolume).

## `decoyFilter` (type: `string`):

Google mixes unrelated generic entries (e.g. "how to cook pasta") into related queries for automated tools. Remove moves them to removedSuspectedDecoys, Flag keeps them with suspectedDecoy: true.

## `trendingNowCountries` (type: `array`):

Country codes to get today's trending searches for, e.g. US, HR, RS, SI, BA. One report per country. Works without search terms.

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

Language for names of regions and topics, e.g. en-US, de, hr.

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

The default Apify datacenter proxy works well. The actor switches to residential proxy by itself if Google starts blocking.

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

Switch to residential proxy after repeated blocks. Slightly higher platform cost, much higher success.

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

How many searches run at once.

## `maxAttempts` (type: `integer`):

Each retry uses a fresh IP address.

## Actor input object example

```json
{
  "searchTerms": [
    "coffee",
    "coffee, tea, matcha"
  ],
  "reports": [
    "interestOverTime",
    "interestByRegion",
    "relatedQueries"
  ],
  "geo": "",
  "timeframe": "today 12-m",
  "category": 0,
  "property": "web",
  "includeLowVolumeRegions": false,
  "decoyFilter": "remove",
  "trendingNowCountries": [],
  "language": "en-US",
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true,
  "maxConcurrency": 5,
  "maxAttempts": 6
}
```

# Actor output Schema

## `reports` (type: `string`):

One record per report. Check status: ok (charged), noData, unavailable or error (free).

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

Counts of reports by status and request statistics.

# 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": [
        "coffee",
        "coffee, tea, matcha"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("leanpilar/google-trends").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": [
        "coffee",
        "coffee, tea, matcha",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("leanpilar/google-trends").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": [
    "coffee",
    "coffee, tea, matcha"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call leanpilar/google-trends --silent --output-dataset

```

## MCP server setup

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

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/gagTt5gXxMuJ5QC1M/builds/JaBxOLrd06xTy6yYE/openapi.json
