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

Scrape Google Trends at scale: interest-over-time for up to 200 keywords, regional breakdown, custom date ranges and 5 search types (Web, Images, News, YouTube, Shopping), plus live Trending Searches by country. Fully automated — add keywords, get clean JSON straight to your dataset.

- **URL**: https://apify.com/utils/google-trends-scraper.md
- **Developed by:** [Oliver Queen](https://apify.com/utils) (community)
- **Categories:** Automation, E-commerce, SEO tools
- **Features:** Limited permissions
- **Stats:** 5 total users, 1 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 4.67 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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, Trending Now & Regional Data

Scrape Google Trends at scale: interest-over-time series for any keyword, daily trending searches per country, and regional interest breakdown - clean JSON straight to your dataset. Built for SEO research, content planning, market intelligence and brand monitoring.

### What it does

- **Interest over time** for any keyword - 0-100 score per day/hour, with an ISO date and Google's own label on every point
- **Flat or grouped output** - one row per data point (ready for CSV/Excel) or one row per keyword with arrays
- **Daily trending searches** per country (US, VN, GB, IN, JP, ...) with traffic estimates
- **5 search types** - Web, Images, News, YouTube, Google Shopping - plus a category filter
- **Regional breakdown** at Country / Region / City / DMA depth for each keyword
- **Related queries** - top & rising searches per keyword (opt-in, no extra fee)
- **Flexible time windows** - preset (past hour to all time) or exact custom range from 2004-01-01 to today
- **Bulk keyword queries** - up to 200 keywords per run
- **Live trending** - perfect for content discovery and competitor monitoring

### Quick start (keyword mode)

1. Pick **Mode = keyword**
2. Paste up to 200 keywords
3. Choose country, time range and search property (Web is recommended)
4. (Optional) *Category* - the `cat=` id from the Google Trends URL (0 = all)
5. *Fetch regional data* is on by default - untick it if you only need the series; pick a *Region resolution* (Auto / Country / Region / City / DMA)
6. *Fetch related queries* is on by default for top & rising queries (adds 1 API call per keyword, no extra fee) - untick for cheap series-only runs
7. Run - output defaults to **flat** (one row per data point); switch *Output format* to *grouped* if you want one row per keyword

Each run produces clean rows in your dataset - ready to export to CSV/Excel, push to a webhook, or feed into your analytics pipeline.

#### Custom date range

Fill *Custom time range* to override the preset window, e.g. `2022-11-01 2022-12-18`.

Rules: valid calendar dates, start on or before end, start on or after 2004-01-01, end not in the future. Invalid ranges fail the run immediately with a clear error message instead of producing empty data.

> Note on News Search: Google Trends has limited historical coverage for news. For older date ranges many keywords legitimately return no news volume even on Google's own UI. For historical research prefer Web Search.

### Quick start (trending mode)

1. Pick **Mode = trending**
2. Choose country, time period (4 / 24 / 48 / 168 hours) and category filter
3. Run

Get the top trending searches right now, sorted by search volume, recency or alphabetical - great for content ideas, news monitoring, and spotting emerging stories.

### Sample output

#### Keyword mode - flat (default)

```json
{"type": "timeseries", "keyword": "bitcoin", "geo": "US", "time": "2022-11-02 2022-12-18",
 "date": "2022-11-03T08:00:00.000Z", "formattedDate": "Nov 3, 2022", "value": 48}
{"type": "region", "keyword": "bitcoin", "geo": "US", "time": "2022-11-02 2022-12-18",
 "geoCode": "US-CA", "geoName": "California", "lat": null, "lng": null, "value": 100}
{"type": "relatedQuery", "keyword": "bitcoin", "geo": "US", "time": "2022-11-02 2022-12-18",
 "query": "bitcoin price", "value": 100, "formattedValue": "100", "list": "top"}
```

| Scenario | What you get |
|---|---|
| Keyword has search volume | one `timeseries` row per point (0-100 value + date) |
| Nobody searched this term in the window | `timeseries` rows with `value: 0` |
| Temporary fetch issue | a single row with `success: false` + `error` |

The last point of an open-ended window may carry `isPartial: true` when Google flags the data as incomplete.

#### Keyword mode - grouped (*Output format = grouped*)

```json
{
  "keyword": "bitcoin",
  "success": true,
  "points": [48, 52, 61, 58],
  "dates": ["2022-11-03T08:00:00.000Z", "2022-11-04T08:00:00.000Z"],
  "formattedDates": ["Nov 3, 2022", "Nov 4, 2022"],
  "geo": "US",
  "time": "2022-11-02 2022-12-18",
  "regions": [
    {"geoCode": "US-CA", "geoName": "California", "value": 100}
  ]
}
```

Interest values are relative (0-100), exactly like trends.google.com: 100 = peak popularity within the selected window.

At City / DMA depth Google returns coordinates instead of an ISO code: `geoCode` is empty and the row carries `lat` / `lng` (see *Region resolution*).

#### Trending mode

```json
{
  "keyword": "super bowl",
  "traffic": "200K+",
  "country": "US",
  "fetchedAt": "2026-08-23T10:15:00Z"
}
```

### Use cases

- **SEO keyword research** - validate search demand before writing content
- **Content calendar planning** - ride trending topics in real time
- **Market research** - compare brand or product interest across 50+ countries
- **Competitor monitoring** - track competitor search volume over time
- **Seasonal pattern analysis** - custom date ranges back to 2004 reveal year-over-year trends
- **Journalism & academic research** - historical interest in a topic
- **Affiliate & e-commerce** - validate product demand before launch

### Pricing

Pay per event, no platform usage charge on top:

| Event | FREE | Business (Gold) |
|---|---|---|
| Keyword analyzed (per success) | $0.005 | $0.0015 |
| Trending topic | $0.0012 | $0.0006 |

Headline: **from $1.50 per 1,000 keywords** at Business plan, **$5.00 per 1,000 keywords** at FREE plan. Failed keywords cost nothing - you only pay when real data is delivered. See the Pricing tab on Store for the full tier breakdown.

### Why this scraper instead of others?

- **Per-keyword pricing, not per-result** - one fee per keyword regardless of how many data points it returns; full daily series included
- **Regional data and related queries included free** - no extra charge for interest by region or top/rising queries
- **No data, no fee** - a keyword with zero search volume still costs you; a keyword that returned nothing due to a network error does not
- **Pure HTTP** - no headless browser, runs fast and cheap
- **Back to 2004** - longer custom date range than most competitors
- **5 search properties + category filter** - Web, Images, News, YouTube, Shopping, any Google Trends category
- **Dates on every point** - ISO timestamps and Google's labels come with the data, no date reconstruction needed

### FAQ

**Q: How is "Keyword analyzed" counted?**
A: Each keyword row pushed to the dataset with `success: true` counts as one event. Failed keywords (`success: false`) are not charged.

**Q: Do I pay for keywords that return all zeros?**
A: Yes - those are real, valid responses from Google. You only avoid paying when the keyword fetch itself failed.

**Q: What happens if a keyword returns no regional data?**
A: The regional rows are simply omitted for that keyword. No extra charge.

**Q: Flat or grouped output?**
A: Flat (default) gives one row per data point, region and related query - best for CSV/Excel exports and charts. Grouped gives one row per keyword with `points`/`dates`/`regions` arrays - best when you consume the dataset through the API.

**Q: Can I scrape news or YouTube trends?**
A: Yes - pick the *Search property* in the input form. Note that News Search has limited historical coverage.

**Q: Why is my run slower for some keywords?**
A: Google occasionally throttles or blocks IPs. We rotate through Cloudflare WARP and free public proxies and accept the first successful response.

**Q: Why does the City breakdown have few cities?**
A: Google only reports city rows with measurable volume for the term and window - niche terms often yield a handful of cities (or none). Metro (DMA) and Region depth are much denser. *Include low-volume geos* (on by default) maximises what Google is willing to return.

**Q: How do I export the data?**
A: From the Apify dataset tab - download as JSON, CSV, Excel, or push to a webhook, API, or cloud storage.

**Q: Can I run this on a schedule?**
A: Yes - use Apify Schedules or the API. Each scheduled run counts as its own paid run.

### Tips

- For best results, keep time windows short - longer historical ranges mean fewer data points per point.
- Fetching regional data adds 1 API call per batch - on by default; untick it if you only need the series.
- *Fetch related queries* adds 1 API call per keyword - on by default; untick it for bulk runs where you only need the series.
- Need city-level or metro-level interest? Set *Region resolution* to City or DMA (requires *Fetch regional data*). Keep *Include low-volume geos* on - without it Google returns mostly empty rows at City depth. Some low-volume terms simply have no city data; the rows Google does return are always delivered as-is.
- The FREE plan is fine for occasional small runs. For heavier use, consider Starter, Scale or Business plan for automatic volume discounts.
- Requests are rate-limited automatically per unique egress IP (*Rate limit per tunnel*, default 6 req/min, 0 = off). Each run starts a random subset of the bundled tunnels and probes their egress IPs: lanes behind the same IP share one pacing budget (Cloudflare's WARP pool is small), so concurrent runs on the same account do not multiply the rate Google sees. An overloaded lane backs off (8s doubling, capped at 120s, never blacklisted for rate limits alone) and the run continues on the rest.
- The session cookie is rotated proactively every 20 keywords, which prevents the long-lived session flags that cause 429s on healthy IPs. Every run fetches fresh data from Google — nothing is cached.

### HE verification (he-harness)

`tools/he-harness/` vendors the read-only HE tier verification SDK: survey, burst, soak, client check and preflight, plus the SDK build. It probes the same HE `/48` egress tier production runs use; it is **not** part of the actor image and never ships to Apify (`.dockerignore` and `.apifyignore` exclude `tools/`).

- Self-check offline: `bash tools/he-harness/tests/smoke.sh`
- Run against a tier: `tools/he-harness/bin/he-survey.sh` (config in `he-harness.env`, gitignored - never commit credentials)
- Setup, tier model and options: `tools/he-harness/README.md`, `SETUP.md`, `USAGE.md`

### Log levels

The `logLevel` input has two values:

- **`summary`** (default) — production-safe. Prints progress and counts only; it never prints an egress IP, a proxy `host:port` or a proxy credential (`user:pass@`).
- **`raw`** — verbose debugging. Adds per-lane egress IPs, proxy endpoints and the entry script's detail log (`/opt/warp/entry.log`).

The entry script runs before the actor reads the input, so its detail is gated by the `RAW_LOGS` env var (default off) and written to `EGRESS_DEBUG_LOG` (default `$WARP_DIR/entry.log`); the actor prints that file only at `raw`. Production never sets `RAW_LOGS=1`.

### Data source

Trends data is sourced from publicly available Google Trends pages via the same endpoints the website itself uses. Values are relative (0-100) within the selected window, exactly as shown on trends.google.com.

***

Built by [apify-solutions](https://apify.com) for SEO, marketing, and research teams that need reliable Google Trends data at scale.

# Actor input Schema

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

keyword: scrape interest-over-time for each keyword. trending: scrape Google's live Trending Now searches (no keywords needed).

## `trendingGeo` (type: `string`):

Country code to fetch trending searches for.

## `trendingHours` (type: `string`):

How far back to look.

## `trendingSort` (type: `string`):

Ordering of results.

## `trendingCategory` (type: `string`):

Filter trending searches by topic.

## `trendingMaxItems` (type: `integer`):

Keep the top N items per geo (1-500).

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

Keywords to query (max 200).

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

Country code. Also used by trending mode when its Country is unset.

## `time` (type: `string`):

Keyword mode: Google Trends time parameter.

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

Keyword mode: optional exact historical window. When filled, it replaces Time range above. Format: YYYY-MM-DD YYYY-MM-DD, e.g. "2022-11-01 2022-12-18". Constraints: valid calendar dates, start on/before end, start on/after 2004-01-01, end not in the future. Invalid ranges fail the run immediately with a clear error instead of returning 400s from Google.

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

Google Trends search property. Note: News Search has limited historical coverage — for custom date ranges far in the past, many keywords legitimately return no data (empty on Google's own UI too). Web Search is recommended for historical research.

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

Google Trends category filter - the cat= URL parameter (0 = all categories). Pick a category in the Google Trends UI and copy its id from the address bar.

## `fetchRegional` (type: `boolean`):

Include interest by region (state/city) breakdown for each keyword. Adds ~1 extra API call per batch. On by default; untick if you only need the series.

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

Geographic depth of the regional breakdown (only used when Fetch regional data is on). Auto = Google's default (country/region level). City/DMA needs 'Include low-volume geos' on (default).

## `includeLowVolumeGeos` (type: `boolean`):

Return every geo Google knows, including very low-volume ones. Needed for Region resolution City/DMA (without it Google replies with mostly empty rows).

## `fetchRelated` (type: `boolean`):

Add top & rising related queries for every keyword. Costs 1 extra API call per keyword, no extra per-event fee. On by default so real runs include related queries; untick for cheap series-only bulk runs.

## `fetchRelatedTopics` (type: `boolean`):

Experimental: top & rising related topics (Knowledge Graph entities with mid ids). Costs 2 extra API calls per keyword (a single-keyword explore + the topics widget). NOTE: since ~2025 Google serves this feed only to logged-in sessions — anonymous runs usually get empty lists (the fetch is best-effort and never fails the run).

## `outputType` (type: `string`):

flat (default): one row per data point - ready for CSV/Excel export and the dataset views. grouped: one row per keyword with points/dates/regions arrays - best for API consumers.

## `includeSummary` (type: `boolean`):

Include per-keyword summary rows (average, peak value/date, latest value/date) computed from the timeline. Free — no extra API calls.

## `logLevel` (type: `string`):

summary (default): 10%% progress lines only. raw: full engine/scheduler log — use when debugging a run.

## `egressFallback` (type: `string`):

What to do when no local WARP tunnel answers the startup probe. 'free' scans public proxies (~8-10s), 'direct' skips the scan and uses the direct source only, 'none' fails the run instead of returning 429-affected partial data. Has no effect while tunnels are up (the free scan is skipped entirely).

## `useDirect` (type: `boolean`):

Also fetch through this machine's own IP (no proxy), interleaved with the proxy rotation. Turns itself off for the rest of the run after 3 consecutive blocks, so it is only a cost when Google accepts the direct IP.

## `rpmPerTunnel` (type: `integer`):

Pacing cap per unique egress IP, in HTTP requests per minute. Lanes that present the same IP share one budget: the run probes each tunnel's egress IP at startup (Cloudflare hands WARP tunnels a small rotating IP pool, so several tunnels often look like one IP) and groups their pacing together. Prevents Google 429s proactively; 0 disables pacing. 14 fits Google's measured 10-15 req/min/IP ceiling and is what keeps a 200-keyword run under ~20s; lower it (e.g. 6) when several runs execute concurrently.

## Actor input object example

```json
{
  "mode": "keyword",
  "trendingGeo": "US",
  "trendingHours": "24",
  "trendingSort": "relevance",
  "trendingCategory": "all",
  "trendingMaxItems": 20,
  "keywords": [
    "artificial intelligence"
  ],
  "geo": "US",
  "time": "today 12-m",
  "property": "",
  "category": 0,
  "fetchRegional": true,
  "regionResolution": "",
  "includeLowVolumeGeos": true,
  "fetchRelated": true,
  "fetchRelatedTopics": false,
  "outputType": "flat",
  "includeSummary": true,
  "logLevel": "summary",
  "egressFallback": "free",
  "useDirect": true,
  "rpmPerTunnel": 14
}
```

# Actor output Schema

## `results` (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": [
        "artificial intelligence"
    ]
};

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

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

```

## MCP server setup

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