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

Get Google Trends data for up to five compared search terms: interest over time, interest by country, region, city or metro, and top and rising related queries and topics. Any region, time range, category or search type, plus each country's trending searches.

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

## Pricing

from $1.25 / 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.

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

Get Google Trends data as clean rows, ready for a spreadsheet, dashboard or model. Give it up to five search terms and it returns, for each term, the 0-100 interest timeline, interest by country, state, city or US metro area, and the top and rising related searches, all on the same scale the Google Trends site uses when you compare terms. Pick any region, time range (from the past hour back to 2004), category and search type: web, image, news, YouTube or Google Shopping searches.

A second mode lists what is trending right now: every trending search of one or more countries over the past 4 hours to 7 days, with its approximate search volume, growth, start and end time, topic categories, the related searches grouped into the trend, and news articles for the top stories.

### Quick Start

Compare two terms in the United States over the past 12 months:

```json
{
  "searchTerms": ["coffee", "tea"],
  "geo": "US",
  "timeRange": "past-12-months"
}
```

List today's trending searches in the US and the UK, biggest first:

```json
{
  "mode": "trending",
  "trendingCountries": ["US", "GB"],
  "trendingSort": "searchVolume",
  "maxItems": 200
}
```

### Input

| Input | Type | Default | Meaning |
| --- | --- | --- | --- |
| `mode` | string | `searchTerms` | `searchTerms` for interest and related searches, `trending` for trending searches. |
| `searchTerms` | array | `[]` | Words or phrases to look up. A Google Trends topic id such as `/m/02vqfm` also works. |
| `compareTerms` | boolean | `true` | On: up to five terms share one scale, so their values are directly comparable. Off: each term (up to 100) is scaled on its own. |
| `geo` | string | `""` | Country (`US`), sub-region (`US-CA`) or US metro (`US-NY-501`). Empty is worldwide. |
| `timeRange` | string | `past-12-months` | `past-hour`, `past-4-hours`, `past-day`, `past-7-days`, `past-30-days`, `past-90-days`, `past-12-months`, `past-5-years` or `all` (2004 to present). |
| `startDate`, `endDate` | string | none | A custom period (`YYYY-MM-DD`); overrides `timeRange`. |
| `category` | integer | `0` | Google Trends category id; `0` is all categories. |
| `searchProperty` | string | `web` | `web`, `images`, `news`, `youtube` or `shopping`. |
| `includeInterestOverTime` | boolean | `true` | Add the interest timeline. |
| `includeInterestByRegion` | boolean | `true` | Add interest per region. |
| `regionResolution` | string | `auto` | `auto`, `COUNTRY` (worldwide only), `REGION`, `CITY` (needs a country) or `DMA` (US metro areas). |
| `includeLowVolumeRegions` | boolean | `false` | Also list regions with too little volume to score. |
| `includeRelatedQueries` | boolean | `true` | Add the top and rising related searches. |
| `trendingCountries` | array | `["US"]` | Countries for the trending mode. |
| `trendingTimeWindow` | string | `past-24-hours` | `past-4-hours`, `past-24-hours`, `past-48-hours` or `past-7-days`. |
| `trendingActiveOnly` | boolean | `false` | Skip trends that have already ended. |
| `trendingSort` | string | `relevance` | `relevance` (Google's order), `searchVolume` or `newest`. |
| `includeTrendingNews` | boolean | `true` | Attach news articles and a picture to the top trending searches. |
| `maxItems` | integer | `100` | Cap on dataset rows. |
| `language` | string | `en-US` | Language for date labels and names. |

### What it returns

Every dataset row has a `kind`. A **`searchTerm`** row is one looked-up term:

| Field | Meaning |
| --- | --- |
| `searchTerm`, `comparedWith` | The term, and the other terms that share its scale. |
| `geo`, `timeRange`, `timeRangeResolved` | The region, the requested range and the exact period Google Trends reported. |
| `category`, `searchProperty` | The category and search type used. |
| `averageInterest` | The term's average over the period, when terms are compared. |
| `interestOverTime` | One point per interval: `time` (UTC), `timestamp`, `formattedTime`, `value` (0-100), `hasData`, and `isPartial` for the interval still filling. |
| `regionResolution`, `interestByRegion` | The region level, then one entry per region: `geoCode`, `geoName`, `value` (0-100), `formattedValue`, `hasData`, and `latitude`/`longitude` for cities. |
| `relatedQueries` | `top` and `rising` lists of `rank`, `query`, `value`, `formattedValue`, `link`; rising entries add `isBreakout` (growth above 5000%). |
| `relatedTopics` | Not available right now; `null`. |
| `missingSections` | Any requested section that came back empty for this term, with a `code`; the rest of the row is complete. |
| `exploreUrl` | The same view on the Google Trends site. |
| `scrapedAt` | Collection time (UTC, ISO 8601). |

A **`trendingSearch`** row is one entry of a country's trending list: `searchTerm`, `geo`, `rank`, `timeWindow`, `searchVolume` and `searchVolumeFormatted` (Google's lower bound, such as `500K+`), `increasePercentage`, `startedAt`, `endedAt`, `isActive`, `categories`, `relatedSearches`, `picture`, `newsArticles` (`title`, `url`, `source`, `picture`), `exploreUrl` and `scrapedAt`.

The run summary (`OUTPUT`) reports `items` (rows delivered), `errors` and the list at `failures`.

### Output example

```json
{
  "kind": "searchTerm",
  "searchTerm": "coffee",
  "comparedWith": ["tea"],
  "geo": "US",
  "timeRange": "past-12-months",
  "timeRangeResolved": "2025-10-23 2026-10-23",
  "category": 0,
  "searchProperty": "web",
  "averageInterest": 78,
  "interestOverTime": [
    {"time": "2026-10-11T00:00:00Z", "timestamp": 1791676800, "formattedTime": "Oct 11 – 17, 2026", "value": 69, "hasData": true, "isPartial": false},
    {"time": "2026-10-18T00:00:00Z", "timestamp": 1792281600, "formattedTime": "Oct 18 – 24, 2026", "value": 66, "hasData": true, "isPartial": true}
  ],
  "regionResolution": "REGION",
  "interestByRegion": [
    {"geoCode": "US-WY", "geoName": "Wyoming", "value": 100, "formattedValue": "100", "hasData": true, "latitude": null, "longitude": null},
    {"geoCode": "US-HI", "geoName": "Hawaii", "value": 47, "formattedValue": "47", "hasData": true, "latitude": null, "longitude": null}
  ],
  "relatedQueries": {
    "top": [
      {"rank": 1, "query": "coffee near me", "value": 100, "formattedValue": "100", "link": "https://trends.google.com/trends/explore?q=coffee+near+me&date=today+12-m&geo=US"}
    ],
    "rising": [
      {"rank": 1, "query": "sports scores today", "value": 5950, "formattedValue": "Breakout", "link": "https://trends.google.com/trends/explore?q=sports+scores+today&date=today+12-m&geo=US", "isBreakout": true}
    ]
  },
  "relatedTopics": null,
  "missingSections": [],
  "exploreUrl": "https://trends.google.com/trends/explore?q=coffee%2Ctea&date=today%2012-m&hl=en-US&geo=US",
  "scrapedAt": "2026-10-23T00:41:06Z"
}
```

```json
{
  "kind": "trendingSearch",
  "searchTerm": "patriots vs bears",
  "geo": "US",
  "rank": 1,
  "timeWindow": "past-24-hours",
  "searchVolume": 500000,
  "searchVolumeFormatted": "500K+",
  "increasePercentage": 1000,
  "startedAt": "2026-10-22T04:00:00Z",
  "endedAt": null,
  "isActive": true,
  "categories": ["Sports"],
  "relatedSearches": ["patriots vs bears", "patriots", "bears vs patriots", "bears game"],
  "picture": null,
  "newsArticles": [],
  "exploreUrl": "https://trends.google.com/trends/explore?q=patriots%20vs%20bears&date=now%201-d&geo=US",
  "scrapedAt": "2026-10-23T00:42:33Z"
}
```

### Terms without enough data and failures

Google Trends only scores terms with enough search volume. A term with no data for your region and period, or one that could not be retrieved, is listed in the run summary at `OUTPUT.failures` with a `code` (`NO_DATA` for too little volume) and a `message`. It is not a dataset row and is not charged. A run in which nothing could be collected exits with an error instead of finishing green with an empty dataset.

### Limits and caveats

- Values are relative (0-100), not search counts, exactly as on the Google Trends site. Compared terms share one scale; separately looked-up terms are each scaled to their own peak.
- Related topics are not available right now.
- Google keeps at most 25 top and 25 rising related searches per term.
- Trending searches cover countries (and some sub-regions), not worldwide. News articles are attached to the top stories only.
- Automated access is subject to Google's terms; use this actor only where you have the necessary permissions and a lawful basis.

### FAQ

**How do I compare more than five terms?** Google Trends puts at most five terms on one scale. Include one common anchor term in each group of five and run the groups separately, or turn `compareTerms` off to score each term on its own.

**Why does the newest point say `isPartial`?** The latest week, day or hour is still filling up, so its value can still change.

**Which region codes work?** ISO country codes (`US`, `DE`, `BR`), sub-regions (`US-CA`, `GB-SCT`, `IN-MH`) and US metro codes (`US-NY-501`). Leave `geo` empty for worldwide.

### Price

You pay per result: each dataset row (one search term, or one trending search) is one result, plus a small run-start charge. The run-start event is charged per GB of memory; the default 512 MB run is one start event. The start is charged even if the run saves no results. Terms without enough data and failed lookups are not charged. Platform usage is included in the price.

# Actor input Schema

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

Search terms: interest and related searches for the terms below. Trending searches: what is trending right now in the countries below.

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

Words or phrases to look up, one per line. With 'Compare terms' on (the default) up to five terms are compared on one shared 0-100 scale, as on the Google Trends site. A Google Trends topic id such as /m/02vqfm also works.

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

On: up to five terms share one scale, so their values are directly comparable. Off: each term (up to 100) is looked up on its own and scaled 0-100 by itself.

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

Where the searches happened: a country code (US, GB, DE), a sub-region (US-CA, GB-SCT) or a US metro (US-NY-501). Leave empty for worldwide.

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

The period to cover. Ignored when a start and end date are set below.

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

Optional custom range start (YYYY-MM-DD, from 2004-01-01). Set together with the end date.

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

Optional custom range end (YYYY-MM-DD, not in the future).

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

Google Trends category id to narrow the searches (0 = all categories). Examples: 71 Food & Drink, 18 Shopping, 958 Jobs, 174 Sports, 7 Finance.

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

Which Google search the interest is measured on.

## `includeInterestOverTime` (type: `boolean`):

The 0-100 interest timeline for each term.

## `includeInterestByRegion` (type: `boolean`):

Each term's 0-100 interest per country, region, city or metro.

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

Auto: countries for a worldwide search, sub-regions for a country. Countries only work worldwide; metros (DMA) only in the US; cities need a country.

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

Also list regions with too little search volume to score (their value is empty).

## `includeRelatedQueries` (type: `boolean`):

Top and rising searches related to each term.

## `includeRelatedTopics` (type: `boolean`):

Top and rising topics related to each term. Google Trends currently returns no related topics for this kind of lookup; while that lasts the section is listed under missingSections and costs nothing extra.

## `trendingCountries` (type: `array`):

Country codes whose trending searches to list (US, GB, IN, BR ...). Some countries also accept a sub-region such as US-CA.

## `trendingTimeWindow` (type: `string`):

How far back trending searches are listed.

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

Skip searches whose trend has already ended.

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

Relevance keeps Google's own order; search volume puts the biggest first; newest puts the most recent first.

## `includeTrendingNews` (type: `boolean`):

Add the news articles and picture Google shows for the top trending searches.

## `maxItems` (type: `integer`):

Cap on dataset rows: one row per search term, or one row per trending search.

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

Language for topic names and date labels, such as en-US, de, es or pt-BR.

## Actor input object example

```json
{
  "mode": "searchTerms",
  "searchTerms": [
    "coffee",
    "tea"
  ],
  "compareTerms": true,
  "geo": "US",
  "timeRange": "past-12-months",
  "category": 0,
  "searchProperty": "web",
  "includeInterestOverTime": true,
  "includeInterestByRegion": true,
  "regionResolution": "auto",
  "includeLowVolumeRegions": false,
  "includeRelatedQueries": true,
  "includeRelatedTopics": false,
  "trendingCountries": [
    "US"
  ],
  "trendingTimeWindow": "past-24-hours",
  "trendingActiveOnly": false,
  "trendingSort": "relevance",
  "includeTrendingNews": true,
  "maxItems": 100,
  "language": "en-US"
}
```

# Actor output Schema

## `results` (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 = {
    "mode": "searchTerms",
    "searchTerms": [
        "coffee",
        "tea"
    ],
    "compareTerms": true,
    "geo": "US",
    "timeRange": "past-12-months",
    "category": 0,
    "searchProperty": "web",
    "trendingCountries": [
        "US"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("barefoot_grade/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 = {
    "mode": "searchTerms",
    "searchTerms": [
        "coffee",
        "tea",
    ],
    "compareTerms": True,
    "geo": "US",
    "timeRange": "past-12-months",
    "category": 0,
    "searchProperty": "web",
    "trendingCountries": ["US"],
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("barefoot_grade/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 '{
  "mode": "searchTerms",
  "searchTerms": [
    "coffee",
    "tea"
  ],
  "compareTerms": true,
  "geo": "US",
  "timeRange": "past-12-months",
  "category": 0,
  "searchProperty": "web",
  "trendingCountries": [
    "US"
  ],
  "maxItems": 100
}' |
apify call barefoot_grade/google-trends-scraper --silent --output-dataset

```

## MCP server setup

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