# Google Trends Scraper - Timeline, Regions, Queries (`sharkinho/google-trends-scraper`) Actor

Scrape Google Trends: interest over time, interest by region, related queries and topics (top & rising) for up to 5 compared terms and big keyword batches, plus Trending now. Any country, time range, category, web/YouTube/News/Images/Shopping. Automatic retries and session rotation.

- **URL**: https://apify.com/sharkinho/google-trends-scraper.md
- **Developed by:** [Sharkinho Tools](https://apify.com/sharkinho) (community)
- **Categories:** SEO tools, E-commerce, Marketing
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 data blocks

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, by region, related queries and Trending now

Scrape **Google Trends** data reliably and export it to JSON, CSV, Excel or Google Sheets. Compare up to **5 keywords** on the same 0-100 scale, run **batches of thousands of keywords**, and get:

- **Interest over time**: the timeline Google shows on the chart (minute, hour, day, week or month points)
- **Interest by region**: countries, states/provinces, metro areas (DMA) or cities
- **Related queries**: *Top* and *Rising* (including "Breakout" queries)
- **Related topics**: *Top* and *Rising* (when Google provides them)
- **Trending now**: today's trending searches for any country, with search volume, growth, category, related searches and news articles

Works for **any country or region**, **any time range** (past hour to 2004-present, or custom dates), **any category**, and **Web, Image, News, YouTube and Google Shopping** search.

### Why this Google Trends scraper?

- **Reliable**: reads the same JSON endpoints the Google Trends website uses (no browser). It handles Google's `)]}'` response prefix and the NID cookie, and retries HTTP 429 rate limits with exponential backoff and a fresh session (new cookies, new fingerprint and, with a proxy, a new IP). One bad keyword never fails the whole run.
- **Clear, fair pricing**: you pay per **data block**, which is one keyword × one output. If you only need timelines, you only pay for timelines. Blocks where Google has no data are **free**.
- **No proxy needed in most cases**: it runs on a direct connection by default and switches to Apify datacenter proxy automatically if Google starts throttling, so you never pay for residential proxy.
- **Two output layouts**: flat rows (one row per date, region or query, ready for Excel and Sheets) or one item per block with arrays (ready for APIs).

### Who uses it

- **SEO and content teams**: find rising queries, check seasonality, and pick between keyword variants.
- **Marketers**: time campaigns to seasonal peaks and see which regions care most.
- **E-commerce and product research**: validate product demand (Google Shopping or YouTube search), spot breakout products, and compare brands.
- **Analysts and researchers**: build long-term time series (2004-present) for many terms in one run.
- **Newsrooms and social teams**: monitor Trending now in any country.

### Input

| Field | What it does |
|---|---|
| `searchTerms` | One line per query. Separate up to 5 terms with commas to compare them (`coffee, tea, matcha`). Add any number of lines for a batch. Topic IDs like `/m/02vqfm` also work. |
| `geo` | `US`, `GB`, `BR`, `US-CA`, `BR-SP`... Leave empty for worldwide. |
| `timeRange` | `past-hour`, `past-4-hours`, `past-day`, `past-7-days`, `past-30-days`, `past-90-days`, `past-12-months`, `past-5-years`, `all` (2004-present) or `custom` (with `startDate` / `endDate`). |
| `category` | Google Trends category ID (0 = all). Use the `cat=` number from a Google Trends URL. |
| `searchProperty` | `web`, `images`, `news`, `youtube`, `shopping` |
| `outputs` | Any of `interestOverTime`, `interestByRegion`, `relatedQueries`, `relatedTopics` |
| `includeTrendingNow` | Also save Trending now for `trendingGeo` (window `trendingHours`: 4, 24, 48 or 168 hours, optional category filter). |
| `outputLayout` | `rows` (flat) or `blocks` (one item per keyword and output) |
| `proxyConfiguration` | Optional. Not needed for normal use. |

Example input:

```json
{
  "searchTerms": ["coffee, tea", "air fryer", "standing desk"],
  "geo": "US",
  "timeRange": "past-12-months",
  "searchProperty": "web",
  "outputs": ["interestOverTime", "interestByRegion", "relatedQueries"],
  "includeTrendingNow": true,
  "trendingGeo": "US",
  "maxTrendingItems": 20
}
```

### Output

Every item has a `type` (`interestOverTime`, `interestByRegion`, `relatedQuery`, `relatedTopic` or `trendingSearch`), the source Google Trends `url` and `scrapedAt`. Filter by `type`, or use the dataset views (Interest over time, Interest by region, Related queries, Trending now).

Interest over time (flat rows layout):

```json
{
  "type": "interestOverTime",
  "searchTerm": "coffee",
  "comparedTerms": "coffee, tea",
  "geo": "US",
  "timeRange": "past-90-days",
  "timeRangeValue": "today 3-m",
  "category": 0,
  "searchProperty": "web",
  "url": "https://trends.google.com/trends/explore?q=coffee%2Ctea&geo=US&date=today+3-m&hl=en",
  "averageValue": 73,
  "date": "2026-08-21T00:00:00.000Z",
  "timestamp": 1787270400,
  "formattedTime": "Aug 21, 2026",
  "value": 67,
  "hasData": true,
  "isPartial": false,
  "scrapedAt": "2026-11-21T23:56:13.825Z"
}
```

Interest by region:

```json
{ "type": "interestByRegion", "searchTerm": "coffee", "geo": "US", "resolution": "REGION",
  "regionCode": "US-HI", "regionName": "Hawaii", "value": 100, "hasData": true, "url": "...", "scrapedAt": "..." }
```

Related query (`rankType` is `top` or `rising`, and rising values show growth such as `+250%` or `Breakout`):

```json
{ "type": "relatedQuery", "searchTerm": "coffee", "rankType": "top", "rank": 1, "query": "coffee near me",
  "value": 100, "formattedValue": "100", "isBreakout": false,
  "link": "https://trends.google.com/trends/explore?q=coffee+near+me&date=today+3-m&geo=US", "url": "...", "scrapedAt": "..." }
```

Trending now:

```json
{ "type": "trendingSearch", "title": "ohio state vs nebraska", "geo": "US", "startedAt": "2026-11-21T10:40:00.000Z",
  "endedAt": null, "isActive": true, "searchVolume": 1000000, "searchVolumeFormatted": "1M+", "increasePercent": 1000,
  "categories": ["Sports"], "relatedQueries": ["ohio state football", "osu vs nebraska"], "newsArticleCount": 46,
  "newsArticles": [{ "title": "...", "url": "...", "source": "..." }], "trendingWindowHours": 24, "url": "...", "scrapedAt": "..." }
```

With `"outputLayout": "blocks"` you get one item per keyword and output, with the rows in a `data` array.

The run's key-value store has an `OUTPUT` record summarising blocks charged, empty blocks (free), failed blocks and request statistics.

### Pricing

Pay per event, with no subscription:

| Event | Price |
|---|---|
| **Data block**: one keyword × one output (for example the 12-month timeline of "coffee", or its interest by region, or its related queries top + rising) | **$0.0015** |
| **Trending search**: one row from Trending now | **$0.0005** |

Examples:

- Timeline for 1,000 keywords: 1,000 blocks = **$1.50**
- Timeline + regions + related queries for 100 keywords: 300 blocks = **$0.45**
- A comparison of 5 terms with timeline only: 5 blocks = $0.0075
- 50 trending searches: $0.025

Blocks where Google returns no data (search volume too low) are **not charged**. The scraper respects your **Max cost per run** and stops cleanly when it is reached.

### FAQ

**Why are the values 0-100 and not search volumes?** Google Trends only publishes relative interest: 100 is the peak for the chosen terms, place and time. Compare terms on one line (`a, b, c`) to put them on the same scale. Trending now does include Google's approximate volume (`1M+`, `20K+`).

**Do I need a proxy?** Usually not. In our tests direct connections from Apify worked without throttling. If Google throttles, the scraper rotates sessions and switches to Apify datacenter proxy automatically. You can also set a proxy yourself.

**Why are related topics sometimes empty?** Google currently returns an empty related-topics list for many automated requests, even for popular terms. Empty blocks are free. Related queries are not affected.

**How many keywords per run?** Up to 5,000 lines. Throughput is about 20-30 keywords per minute with all three main outputs.

**Can I schedule it?** Yes. Use Apify schedules, for example daily Trending now or weekly keyword timelines, and send the results to Google Sheets, Slack or a webhook with integrations.

**Is it legal?** It collects aggregated, anonymous public statistics from Google Trends and no personal data. Check that your use complies with Google's terms and your local laws.

### Limits

- Google allows at most 5 terms per comparison.
- Values are sampled by Google and can differ slightly between runs, which is normal Google Trends behaviour.
- The most recent point is often incomplete (`isPartial: true`). Turn off `includePartialData` to drop it.
- Trending now is available per country, not for sub-regions.
- Metro (DMA) resolution exists for the US only. City resolution returns coordinates instead of codes.

# Actor input Schema

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

One line per query. Put up to 5 terms on one line separated by commas to compare them on the same 0-100 scale (e.g. "coffee, tea, matcha"). Add as many lines as you like for batch runs. Google Topic IDs such as /m/02vqfm also work.

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

ISO country code (US, GB, BR, DE...), or a region code like US-CA or BR-SP. Leave empty for worldwide.

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

Period to analyse. Shorter ranges give finer resolution (minute/hour/day), longer ones give weekly or monthly points.

## `startDate` (type: `string`):

Only for time range "Custom". Format YYYY-MM-DD (earliest 2004-01-01).

## `endDate` (type: `string`):

Only for time range "Custom". Format YYYY-MM-DD.

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

Overrides the time range with a raw Google Trends value, e.g. "today 3-m", "now 7-d", "2024-01-01 2024-03-31" or "2024-05-01T10 2024-05-03T10" (hourly). Leave empty normally.

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

Google Trends category ID to narrow ambiguous terms. 0 = all categories. Examples: 3 Arts & Entertainment, 5 Computers & Electronics, 7 Finance, 18 Shopping, 44 Beauty & Fitness, 45 Health, 47 Autos & Vehicles, 67 Travel, 71 Food & Drink, 958 Jobs & Education, 20 Sports. The cat= number in a Google Trends URL is the ID.

## `searchProperty` (type: `string`):

Which Google search to measure.

## `outputs` (type: `array`):

Each selected output for each term is one billed data block. Blocks where Google has no data are free.

## `relatedRankTypes` (type: `array`):

Top = most popular overall; Rising = fastest growing ("Breakout" = grew more than 5000%).

## `dropUnrelatedBreakouts` (type: `boolean`):

Google Trends often adds rising "Breakout" queries that have nothing to do with your term (e.g. "hotel booking" for "air fryer"). When on, rising Breakout queries that share no word with the search term are removed. Turn off to get the raw list.

## `maxRelatedItems` (type: `integer`):

Google returns up to about 25 items per list.

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

Granularity of interest by region.

## `includeLowSearchVolumeRegions` (type: `boolean`):

Also return regions where Google has too little data (value 0).

## `includePartialData` (type: `boolean`):

The latest point of a timeline is often still incomplete; it is flagged with isPartial=true. Uncheck to drop it.

## `includeTrendingNow` (type: `boolean`):

Adds the current trending searches of a country (the Google Trends 'Trending now' page). Can be used with no search terms.

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

Country code for Trending now, e.g. US, GB, DE, BR, IN.

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

How far back trending searches go.

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

Only keep trending searches in this category.

## `trendingActiveOnly` (type: `boolean`):

Skip trends that have already ended.

## `trendingIncludeNews` (type: `boolean`):

Adds news headlines, sources and links (available for the top trends).

## `maxTrendingItems` (type: `integer`):

Maximum number of trending searches to save (each one is billed as one trending-search result).

## `outputLayout` (type: `string`):

Rows: one dataset item per timeline point, region or related query. Blocks: one dataset item per term and output with the data in an array. Price is the same.

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

Language for region and topic names, e.g. en-US, de, pt-BR.

## `timezoneOffsetMinutes` (type: `integer`):

Affects how hourly/daily buckets are cut. Same sign as JavaScript getTimezoneOffset(): 300 = New York (UTC-5), -60 = Berlin (UTC+1). Output dates are always ISO in UTC.

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

How many term lines to process at once. Higher is faster but Google throttles harder; use 3-5 only with a proxy.

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

Throttled requests are retried with exponential backoff and a fresh session each time.

## `autoProxyFallback` (type: `boolean`):

When running without a proxy and Google throttles repeatedly, switch to Apify datacenter proxy automatically.

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

Not needed in most cases. If you scrape thousands of terms, Apify datacenter proxy helps; residential is rarely needed.

## Actor input object example

```json
{
  "searchTerms": [
    "coffee, tea"
  ],
  "geo": "US",
  "timeRange": "past-90-days",
  "category": 0,
  "searchProperty": "web",
  "outputs": [
    "interestOverTime",
    "interestByRegion",
    "relatedQueries"
  ],
  "relatedRankTypes": [
    "top",
    "rising"
  ],
  "dropUnrelatedBreakouts": true,
  "maxRelatedItems": 25,
  "regionResolution": "auto",
  "includeLowSearchVolumeRegions": false,
  "includePartialData": true,
  "includeTrendingNow": true,
  "trendingGeo": "US",
  "trendingHours": "24",
  "trendingCategory": "0",
  "trendingActiveOnly": false,
  "trendingIncludeNews": true,
  "maxTrendingItems": 20,
  "outputLayout": "rows",
  "language": "en-US",
  "timezoneOffsetMinutes": 0,
  "maxConcurrency": 2,
  "maxRetries": 8,
  "autoProxyFallback": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `interestOverTime` (type: `string`):

No description

## `interestByRegion` (type: `string`):

No description

## `relatedQueries` (type: `string`):

No description

## `trendingNow` (type: `string`):

No description

## `items` (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 = {
    "searchTerms": [
        "coffee, tea"
    ],
    "geo": "US",
    "timeRange": "past-90-days",
    "outputs": [
        "interestOverTime",
        "interestByRegion",
        "relatedQueries"
    ],
    "includeTrendingNow": true,
    "trendingGeo": "US",
    "maxTrendingItems": 20,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("sharkinho/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": ["coffee, tea"],
    "geo": "US",
    "timeRange": "past-90-days",
    "outputs": [
        "interestOverTime",
        "interestByRegion",
        "relatedQueries",
    ],
    "includeTrendingNow": True,
    "trendingGeo": "US",
    "maxTrendingItems": 20,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("sharkinho/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": [
    "coffee, tea"
  ],
  "geo": "US",
  "timeRange": "past-90-days",
  "outputs": [
    "interestOverTime",
    "interestByRegion",
    "relatedQueries"
  ],
  "includeTrendingNow": true,
  "trendingGeo": "US",
  "maxTrendingItems": 20,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call sharkinho/google-trends-scraper --silent --output-dataset

```

## MCP server setup

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