# Google Trending Historical Data (`ilborso/google-trending-historical-data`) Actor

Get search interest over time, by region, related queries, and related topics. Returns Google Trends data for a keyword: interest over time, interest by region, related queries, and related topics.

- **URL**: https://apify.com/ilborso/google-trending-historical-data.md
- **Developed by:** [Fabio Borsotti](https://apify.com/ilborso) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Historical & Search Interest Data

An Apify Actor that extracts comprehensive Google Trends data for any keyword, including search interest over time, interest by geographic region, related queries, and related topics.

### What does this Actor do?

This Actor retrieves structured Google Trends data directly for any specified keyword or topic:

1. **Search Interest Over Time** — Normalized search volume timelines (0–100 index) across custom timeframes (e.g., past 12 months, 5 years, or custom date ranges).
2. **Interest by Region** — Geographic distribution of search interest at various granularities (country, state/region, DMA metro area, or city level).
3. **Related Queries** — Discover what else people are searching for:
   - **Top Queries**: Most popular related queries ranked by relative volume.
   - **Rising Queries**: Fast-growing terms with percentage spikes or "Breakout" status (>5000% increase).
4. **Related Topics** — Google Knowledge Graph entities connected to your keyword (titles, types, and entity IDs).
5. **Multi-Property Coverage** — Query standard Google Web Search, Google Images, Google News, YouTube, or Google Shopping (Froogle).

### Key Features

- **Historical & Real-Time Data** — Analyze search interest from recent hours to multi-year historical archives.
- **Granular Geolocation** — Filter worldwide or target specific countries (e.g., `US`, `GB`, `DE`, `IT`) or sub-regions (`US-CA`, `IT-RM`).
- **Flexible Data Types** — Request complete overviews or target specific widgets (`TIMESERIES`, `GEO_MAP`, `RELATED_QUERIES`, `RELATED_TOPICS`).
- **Property Filtering** — Compare search trends on Web Search vs. YouTube, Google Images, Google News, or Shopping.
- **Production-Ready Output** — Saves flattened records directly into the Apify Dataset and Key-Value store (`OUTPUT`), perfectly optimized for tabular export to CSV, Excel, and JSON.

***

### Input Parameters

The Actor accepts the following input parameters:

#### Required

| Parameter | Type | Description |
|-----------|------|-------------|
| `q` | string | Search keyword or phrase to analyze (e.g. `bitcoin`, `climate change`, `artificial intelligence`). |

#### Optional

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `geo` | string | `""` *(worldwide)* | Two-letter country code or sub-region code. Defaults to worldwide when omitted or empty. Examples: `US`, `GB`, `DE`, `IT`, `US-CA`. |
| `hl` | string | `"en"` | Language code for the interface and localized labels (e.g. `en`, `es`, `fr`, `it`, `de`). |
| `date` | string | `"today 12-m"` | Time range for the search interest query. Examples: `today 12-m`, `today 3-m`, `today 1-m`, `today 5-y`, or custom date range `YYYY-MM-DD YYYY-MM-DD` (e.g. `2024-01-01 2024-12-31`). |
| `tz` | string | `"420"` | Timezone offset in minutes from UTC (e.g. `420` for UTC-7). |
| `data_type` | string | `""` *(default)* | Widget filter to restrict returned data. When omitted, returns both `TIMESERIES` and `GEO_MAP`. See options below. |
| `cat` | string | `"0"` *(all)* | Category ID to narrow results. Defaults to all categories (`0`). |
| `gprop` | string | `""` *(web search)* | Google property to query. Options: `""` (Web Search), `images`, `news`, `youtube`, `froogle`. |
| `region` | string | `""` *(auto)* | Granularity for geographic breakdown: `COUNTRY`, `REGION`, `DMA`, `CITY`. |
| `max_results` | integer | `100` | Maximum number of records to return in the dataset. Limits the output list to at most `max_results` items. |

#### `data_type` Options

| Value | Description |
|-------|-------------|
| *(omitted / empty)* | Returns both **TIMESERIES** (interest over time) and **GEO_MAP** (interest by region). |
| `TIMESERIES` | Interest over time timeline data only. |
| `GEO_MAP` | Compared breakdown by region (for multiple queries). |
| `GEO_MAP_0` | Interest by region (for a single query). |
| `RELATED_QUERIES` | Top and rising related search queries. |
| `RELATED_TOPICS` | Top and rising related Knowledge Graph topics. |

> **Note:** `RELATED_QUERIES` and `RELATED_TOPICS` are not included in the default response. To retrieve them, specify `data_type="RELATED_QUERIES"` or `data_type="RELATED_TOPICS"`.

***

### Example Inputs

#### 1. Default (Interest Over Time + Regional Breakdown)

```json
{
  "q": "bitcoin",
  "geo": "US",
  "hl": "en",
  "date": "today 12-m",
  "max_results": 100
}
```

#### 2. Historical 5-Year Trend

```json
{
  "q": "artificial intelligence",
  "geo": "US",
  "date": "today 5-y",
  "data_type": "TIMESERIES"
}
```

#### 3. Regional Breakdown at City Level

```json
{
  "q": "coffee",
  "geo": "US",
  "data_type": "GEO_MAP_0",
  "region": "CITY"
}
```

#### 4. Related Search Queries

```json
{
  "q": "bitcoin",
  "geo": "US",
  "data_type": "RELATED_QUERIES"
}
```

#### 5. Related Topics (Entities)

```json
{
  "q": "bitcoin",
  "geo": "US",
  "data_type": "RELATED_TOPICS"
}
```

#### 6. YouTube Trends (Last 3 Months)

```json
{
  "q": "gaming",
  "geo": "US",
  "gprop": "youtube",
  "date": "today 3-m"
}
```

***

### Output Format

The Actor returns a **flattened list of objects** without complex or nested JSON structures. Every object in the returned list always contains all 25 mapped fields, guaranteeing a uniform tabular schema for direct export to CSV, Excel, or database imports.

In every record, all inactive/unrelated fields are set to an empty string (`""`), ensuring consistent columns across the entire dataset.

#### 25 Output Fields

Every returned record in the dataset always contains the following 25 keys:

| Field | Type | Description |
|-------|------|-------------|
| `interest_over_time.timeline_data.date` | string | Human-readable date range for the timeline point (e.g. `Apr 6 – 12, 2025`). |
| `interest_over_time.timeline_data.timestamp` | string | Formatted UTC timestamp for the start of the period (`YYYY-MM-DD HH:MM:SS`). |
| `interest_over_time.timeline_data.query` | string | Search keyword query. |
| `interest_over_time.timeline_data.value` | string | Relative interest index (0–100). |
| `interest_over_time.timeline_data.extracted_value` | integer / string | Numeric representation of the interest index (e.g. `40`, `100`). |
| `interest_by_region.geo` | string | Region code (e.g. `US-HI`, `US-NV`, `IT-RM`). |
| `interest_by_region.location` | string | Human-readable region or location name (e.g. `Hawaii`, `Nevada`). |
| `interest_by_region.value` | string | Relative interest index (0–100). |
| `interest_by_region.extracted_value` | integer / string | Numeric representation of the regional interest value. |
| `related_queries.rising.query` | string | Search query with rising interest. |
| `related_queries.rising.value` | string | Growth metric or percentage (e.g. `Breakout`, `+250%`). |
| `related_queries.rising.extracted_value` | integer / string | Numeric representation of rising query growth (e.g. `9750`). |
| `related_queries.rising.link` | string | Direct URL link to explore the rising query on Google Trends. |
| `related_queries.top.query` | string | Top related search query. |
| `related_queries.top.value` | string | Relative interest index (0–100). |
| `related_queries.top.extracted_value` | integer / string | Numeric representation of the top query value. |
| `related_queries.top.link` | string | Direct URL link to explore the top query on Google Trends. |
| `related_topics.rising.query` | string | Topic entity name with rising interest (e.g. `NVIDIA`). |
| `related_topics.rising.value` | string | Growth metric or percentage (e.g. `Breakout`, `+500%`). |
| `related_topics.rising.extracted_value` | integer / string | Numeric representation of rising topic growth (e.g. `71150`). |
| `related_topics.rising.link` | string | Direct URL link to explore the rising topic on Google Trends. |
| `related_topics.top.query` | string | Top related topic entity name (e.g. `Bitcoin`). |
| `related_topics.top.value` | string | Relative interest index (0–100). |
| `related_topics.top.extracted_value` | integer / string | Numeric representation of the top topic value. |
| `related_topics.top.link` | string | Direct URL link to explore the top topic on Google Trends. |

#### Example Flattened Output

```json
[
  {
    "interest_over_time.timeline_data.date": "Oct 19 – 25, 2025",
    "interest_over_time.timeline_data.timestamp": "2025-10-19 00:00:00",
    "interest_over_time.timeline_data.query": "bitcoin",
    "interest_over_time.timeline_data.value": "30",
    "interest_over_time.timeline_data.extracted_value": 30,
    "interest_by_region.geo": "",
    "interest_by_region.location": "",
    "interest_by_region.value": "",
    "interest_by_region.extracted_value": "",
    "related_queries.rising.query": "",
    "related_queries.rising.value": "",
    "related_queries.rising.extracted_value": "",
    "related_queries.rising.link": "",
    "related_queries.top.query": "",
    "related_queries.top.value": "",
    "related_queries.top.extracted_value": "",
    "related_queries.top.link": "",
    "related_topics.rising.query": "",
    "related_topics.rising.value": "",
    "related_topics.rising.extracted_value": "",
    "related_topics.rising.link": "",
    "related_topics.top.query": "",
    "related_topics.top.value": "",
    "related_topics.top.extracted_value": "",
    "related_topics.top.link": ""
  },
  {
    "interest_over_time.timeline_data.date": "",
    "interest_over_time.timeline_data.timestamp": "",
    "interest_over_time.timeline_data.query": "",
    "interest_over_time.timeline_data.value": "",
    "interest_over_time.timeline_data.extracted_value": "",
    "interest_by_region.geo": "US-KS",
    "interest_by_region.location": "Kansas",
    "interest_by_region.value": "100",
    "interest_by_region.extracted_value": 100,
    "related_queries.rising.query": "",
    "related_queries.rising.value": "",
    "related_queries.rising.extracted_value": "",
    "related_queries.rising.link": "",
    "related_queries.top.query": "",
    "related_queries.top.value": "",
    "related_queries.top.extracted_value": "",
    "related_queries.top.link": "",
    "related_topics.rising.query": "",
    "related_topics.rising.value": "",
    "related_topics.rising.extracted_value": "",
    "related_topics.rising.link": "",
    "related_topics.top.query": "",
    "related_topics.top.value": "",
    "related_topics.top.extracted_value": "",
    "related_topics.top.link": ""
  },
  {
    "interest_over_time.timeline_data.date": "",
    "interest_over_time.timeline_data.timestamp": "",
    "interest_over_time.timeline_data.query": "",
    "interest_over_time.timeline_data.value": "",
    "interest_over_time.timeline_data.extracted_value": "",
    "interest_by_region.geo": "",
    "interest_by_region.location": "",
    "interest_by_region.value": "",
    "interest_by_region.extracted_value": "",
    "related_queries.rising.query": "how to buy bitcoin safely",
    "related_queries.rising.value": "Breakout",
    "related_queries.rising.extracted_value": 9750,
    "related_queries.rising.link": "https://trends.google.com/trends/explore?q=how+to+buy+bitcoin+safely&date=today+12-m&geo=US",
    "related_queries.top.query": "",
    "related_queries.top.value": "",
    "related_queries.top.extracted_value": "",
    "related_queries.top.link": "",
    "related_topics.rising.query": "",
    "related_topics.rising.value": "",
    "related_topics.rising.extracted_value": "",
    "related_topics.rising.link": "",
    "related_topics.top.query": "",
    "related_topics.top.value": "",
    "related_topics.top.extracted_value": "",
    "related_topics.top.link": ""
  },
  {
    "interest_over_time.timeline_data.date": "",
    "interest_over_time.timeline_data.timestamp": "",
    "interest_over_time.timeline_data.query": "",
    "interest_over_time.timeline_data.value": "",
    "interest_over_time.timeline_data.extracted_value": "",
    "interest_by_region.geo": "",
    "interest_by_region.location": "",
    "interest_by_region.value": "",
    "interest_by_region.extracted_value": "",
    "related_queries.rising.query": "",
    "related_queries.rising.value": "",
    "related_queries.rising.extracted_value": "",
    "related_queries.rising.link": "",
    "related_queries.top.query": "bitcoin price",
    "related_queries.top.value": "100",
    "related_queries.top.extracted_value": 100,
    "related_queries.top.link": "https://trends.google.com/trends/explore?q=bitcoin+price&date=today+12-m&geo=US",
    "related_topics.rising.query": "",
    "related_topics.rising.value": "",
    "related_topics.rising.extracted_value": "",
    "related_topics.rising.link": "",
    "related_topics.top.query": "",
    "related_topics.top.value": "",
    "related_topics.top.extracted_value": "",
    "related_topics.top.link": ""
  },
  {
    "interest_over_time.timeline_data.date": "",
    "interest_over_time.timeline_data.timestamp": "",
    "interest_over_time.timeline_data.query": "",
    "interest_over_time.timeline_data.value": "",
    "interest_over_time.timeline_data.extracted_value": "",
    "interest_by_region.geo": "",
    "interest_by_region.location": "",
    "interest_by_region.value": "",
    "interest_by_region.extracted_value": "",
    "related_queries.rising.query": "",
    "related_queries.rising.value": "",
    "related_queries.rising.extracted_value": "",
    "related_queries.rising.link": "",
    "related_queries.top.query": "",
    "related_queries.top.value": "",
    "related_queries.top.extracted_value": "",
    "related_queries.top.link": "",
    "related_topics.rising.query": "Suriname",
    "related_topics.rising.value": "Breakout",
    "related_topics.rising.extracted_value": 64050,
    "related_topics.rising.link": "https://trends.google.com/trends/explore?q=/m/06nnj&date=today+1-m&geo=US",
    "related_topics.top.query": "",
    "related_topics.top.value": "",
    "related_topics.top.extracted_value": "",
    "related_topics.top.link": ""
  },
  {
    "interest_over_time.timeline_data.date": "",
    "interest_over_time.timeline_data.timestamp": "",
    "interest_over_time.timeline_data.query": "",
    "interest_over_time.timeline_data.value": "",
    "interest_over_time.timeline_data.extracted_value": "",
    "interest_by_region.geo": "",
    "interest_by_region.location": "",
    "interest_by_region.value": "",
    "interest_by_region.extracted_value": "",
    "related_queries.rising.query": "",
    "related_queries.rising.value": "",
    "related_queries.rising.extracted_value": "",
    "related_queries.rising.link": "",
    "related_queries.top.query": "",
    "related_queries.top.value": "",
    "related_queries.top.extracted_value": "",
    "related_queries.top.link": "",
    "related_topics.rising.query": "",
    "related_topics.rising.value": "",
    "related_topics.rising.extracted_value": "",
    "related_topics.rising.link": "",
    "related_topics.top.query": "Bitcoin",
    "related_topics.top.value": "100",
    "related_topics.top.extracted_value": 100,
    "related_topics.top.link": "https://trends.google.com/trends/explore?q=/m/05p0rrx&date=today+1-m&geo=US"
  }
]
```

***

### Error Handling

The Actor handles failures gracefully with informative messages:

| Scenario | Behavior |
|----------|----------|
| Missing `q` parameter | Fails immediately with descriptive message requiring `q`. |
| HTTP 4xx / 5xx upstream response | Fails reporting the HTTP status code and response body snippet. |
| Network Timeout | Fails reporting timeout after 60 seconds. |
| Invalid JSON response | Fails reporting parsing failure details. |

# Actor input Schema

## `q` (type: `string`):

Search keyword to analyze on Google Trends (e.g., 'bitcoin', 'climate change').

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

Location code (e.g., 'US', 'GB', 'DE', 'US-CA'). Defaults to worldwide when empty.

## `hl` (type: `string`):

Language code for the interface (e.g., 'en', 'es', 'fr', 'it'). Default: 'en'.

## `date` (type: `string`):

Time range. Examples: 'today 12-m', 'today 3-m', 'today 5-y', '2024-01-01 2024-12-31'. Default: 'today 12-m'.

## `tz` (type: `string`):

Timezone offset in minutes from UTC. Default: '420'.

## `data_type` (type: `string`):

Widget filter. When omitted/empty, returns TIMESERIES + GEO_MAP by default.

## `cat` (type: `string`):

Category to narrow results. Defaults to all categories.

## `gprop` (type: `string`):

Google property to search. Options: Web Search (default), images, news, youtube, froogle.

## `region` (type: `string`):

Granularity for geo breakdown: COUNTRY, REGION, DMA, CITY. Defaults to auto when empty.

## `max_results` (type: `integer`):

Maximum number of results to return in the dataset. Defaults to 100.

## Actor input object example

```json
{
  "q": "bitcoin",
  "geo": "US",
  "hl": "en",
  "date": "today 12-m",
  "tz": "420",
  "data_type": "",
  "cat": "0",
  "gprop": "",
  "region": "",
  "max_results": 100
}
```

# 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 = {
    "q": "bitcoin",
    "geo": "US",
    "hl": "en",
    "date": "today 12-m",
    "tz": "420"
};

// Run the Actor and wait for it to finish
const run = await client.actor("ilborso/google-trending-historical-data").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 = {
    "q": "bitcoin",
    "geo": "US",
    "hl": "en",
    "date": "today 12-m",
    "tz": "420",
}

# Run the Actor and wait for it to finish
run = client.actor("ilborso/google-trending-historical-data").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 '{
  "q": "bitcoin",
  "geo": "US",
  "hl": "en",
  "date": "today 12-m",
  "tz": "420"
}' |
apify call ilborso/google-trending-historical-data --silent --output-dataset

```

## MCP server setup

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

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/apZsWGb84qi9VfEel/builds/PyfIDZTvmw12oNCA1/openapi.json
