# Google Trends Scraper (Interest, Regions & Rising Queries) (`phoebe-labs/google-trends-scraper`) Actor

Extract historical and real-time Google Trends metrics: Interest Over Time, Regional/Subregional Breakdowns, and Related Rising Queries with auto-retry resilience.

- **URL**: https://apify.com/phoebe-labs/google-trends-scraper.md
- **Developed by:** [Phoebe Labs](https://apify.com/phoebe-labs) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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 (Interest, Regions & Rising Queries) 📈

Fast, resilient, and enterprise-grade Google Trends scraper. Extract historical search interest, subregional geographic distributions, and breakout rising queries with automated anti-throttling session management.

***

### 🚀 Why Use This Scraper?

Most Google Trends scrapers break or fail unpredictably (often showing a 20%+ failure rate) due to aggressive Google rate-limiting (`429 Too Many Requests`) and brittle token parsing.

**This Actor is engineered specifically for resilience:**

- **Automated Session Warming:** Re-authenticates and manages clean Google session tokens dynamically.
- **Jittered Exponential Backoff:** Gracefully handles temporary spikes without failing your run.
- **Batch Processing:** Processes up to 5 comparison terms per query to reduce run time and compute cost.
- **Agent & MCP Ready:** Delivers clean, structured JSON optimized for LLMs, RAG pipelines, and automated market research.

***

### 🔍 What Data Can You Extract?

1. **Interest Over Time:** Multi-point timeline index (0–100) across custom time horizons.
2. **Regional Breakdown:** Geographic interest across US states, DMAs (designated market areas), or global countries.
3. **Related & Rising Queries:** Uncover emerging keyword opportunities and breakout viral topics before they peak.

***

### 🛠️ Input Parameters

Configure your run via the Apify Console UI or pass the following JSON payload via API:

```json
{
  "searchTerms": ["artificial intelligence", "quantum computing"],
  "timeRange": "today 12-m",
  "geo": "US",
  "property": "web",
  "includeInterestOverTime": true,
  "includeSubregions": true,
  "includeRelatedQueries": true
}
```

#### Parameter Reference

| Field | Type | Description | Allowed Values / Examples | Default |
|---|---|---|---|---|
| `searchTerms` *(required)* | Array of strings | Keywords or search queries to track. | `["tesla", "rivian"]` | `["artificial intelligence"]` |
| `timeRange` | String | Time window for historical trend analysis. | `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` | `today 12-m` |
| `geo` | String | Two-letter ISO country code. Leave blank for worldwide. | `US`, `GB`, `DE`, `CA`, `AU`, `FR` | `US` |
| `property` | String | Search engine vertical. | `web`, `images`, `news`, `youtube`, `froogle` (Shopping) | `web` |
| `category` | Integer | Google Trends category ID. `0` for all categories. | `0`, `396` (Real Estate), `5` (Computers) | `0` |
| `includeInterestOverTime` | Boolean | Include historical timeline index datapoints. | `true`, `false` | `true` |
| `includeSubregions` | Boolean | Include breakdown by state/region/country. | `true`, `false` | `true` |
| `includeRelatedQueries` | Boolean | Include top and rising / breakout searches. | `true`, `false` | `true` |

***

### 📊 Sample Output

Results are pushed directly to your Apify Dataset. You can export to JSON, CSV, Excel, or consume via REST API:

```json
[
  {
    "keyword": "quantum computing",
    "geo": "US",
    "timeRange": "today 12-m",
    "scrapedAt": "2026-11-03T06:12:20.649Z",
    "interestOverTime": [
      {
        "time": "Nov 2 – 8, 2025",
        "value": 14
      },
      {
        "time": "Nov 9 – 15, 2025",
        "value": 16
      },
      {
        "time": "Dec 7 – 13, 2025",
        "value": 27
      }
    ],
    "regionalInterest": [
      {
        "geoCode": "US-MD",
        "geoName": "Maryland",
        "value": 100,
        "formattedValue": "100"
      },
      {
        "geoCode": "US-CO",
        "geoName": "Colorado",
        "value": 96,
        "formattedValue": "96"
      },
      {
        "geoCode": "US-MA",
        "geoName": "Massachusetts",
        "value": 92,
        "formattedValue": "92"
      }
    ],
    "relatedQueries": {
      "top": [
        {
          "query": "what is quantum computing",
          "value": 100,
          "formattedValue": "100"
        },
        {
          "query": "quantum computing stocks",
          "value": 68,
          "formattedValue": "68"
        }
      ],
      "rising": [
        {
          "query": "quantum computing ai breakthrough",
          "value": 1250,
          "formattedValue": "Breakout"
        }
      ]
    }
  }
]
```

***

### 💻 How to Run Programmatically (Python & JavaScript)

#### JavaScript / Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('phoebe-labs/google-trends-scraper').call({
    searchTerms: ['electric vehicles', 'hybrid cars'],
    timeRange: 'today 12-m',
    geo: 'US',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')

run = client.actor('phoebe-labs/google-trends-scraper').call(run_input={
    'searchTerms': ['nvidia', 'amd'],
    'timeRange': 'today 3-m',
    'geo': 'US',
})

for item in client.dataset(run['defaultDatasetId']).iterate_items():
    print(item)
```

***

### 💡 Common Use Cases

- **SEO & Content Strategy:** Identify rising/breakout topics before competitors catch on.
- **Product & E-Commerce Validation:** Compare seasonal demand curves across product categories.
- **Financial & Market Intelligence:** Track brand health, consumer sentiment spikes, and viral momentum.
- **AI Agents & Automated Reports:** Plug straight into Claude, Cursor, LangChain, or Zapier/Make automations.

***

### 🛡️ Support & Feedback

If you need a custom integration, encounter an edge-case query, or have a feature request, please open an issue in the **Issues** tab or contact **Phoebe Labs**.

# Actor input Schema

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

Keywords or search terms to analyze (e.g. 'artificial intelligence', 'real estate', 'crypto').

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

Select the timeframe for trend analysis.

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

Two-letter ISO country code (e.g., 'US', 'GB', 'DE', 'CA') or leave empty for Worldwide.

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

Filter by Google Trends category ID (0 for all categories).

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

Google search property to query.

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

Extract historical timeline datapoints.

## `includeSubregions` (type: `boolean`):

Extract interest broken down by state, subregion, or country.

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

Extract top and breakout / rising search terms related to your query.

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

Apify proxy configuration. Google Trends strongly benefits from residential or datacenter proxies for high-volume runs.

## Actor input object example

```json
{
  "searchTerms": [
    "artificial intelligence",
    "machine learning"
  ],
  "timeRange": "today 12-m",
  "geo": "US",
  "category": 0,
  "property": "web",
  "includeInterestOverTime": true,
  "includeSubregions": true,
  "includeRelatedQueries": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing the extracted trend metrics per keyword.

# 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": [
        "artificial intelligence",
        "machine learning"
    ]
};

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

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

```

## MCP server setup

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