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

Google Trends Intelligence Scraper: Extract interest over time time-series, subregion breakdowns, breakout related search queries, and top rising search topics globally or by country. Designed for real-time market research, consumer demand forecasting, and viral search trend discovery analytics.

- **URL**: https://apify.com/khnaami/actor-google-trends-scraper.md
- **Developed by:** [khalid naami](https://apify.com/khnaami) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## 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, Region & Related Queries)

Extract real-time and historical search trend intelligence from Google Trends at scale. Scrape interest over time (timeline scores 0-100), regional geographic breakdown, Top & Rising (Breakout) related search queries, and related topics.

***

### 🌟 Key Features

- ⏳ **Interest Over Time**: Extract historical timeline index scores (0 to 100) across custom timeframes.
- 🗺️ **Interest by Region / Country**: Capture geographic distribution and density of search interest across subregions or worldwide.
- 🚀 **Breakout & Rising Queries**: Detect viral surges and new search terms gaining rapid momentum before competitors.
- 🏷️ **Related Topics**: Identify thematic associations, entities, and categories linked to your core keywords.
- 🌍 **Global or Country-Specific Filtering**: Analyze worldwide trends or target specific nations (`US`, `GB`, `FR`, `DE`, `SA`, `JP`, etc.).
- 🛡️ **Apify Proxy Built-in**: Full proxy rotation to prevent rate-limiting and ensure continuous trend monitoring.

***

### 📥 Input Configuration

| Field | Type | Default | Description |
|---|---|---|---|
| `searchTerms` | Array | `["Artificial Intelligence", "ChatGPT"]` | List of keywords or topics to analyze. |
| `geo` | String | `""` | Country code (e.g. `US`, `GB`, `DE`, `FR`, `SA`) or empty for Worldwide. |
| `timeframe` | String | `"today 12-m"` | Duration to evaluate (`now 1-d`, `now 7-d`, `today 1-m`, `today 3-m`, `today 12-m`, `today 5-y`, `all`). |
| `hl` | String | `"en"` | Language code for query and topic names. |
| `extractInterestOverTime` | Boolean | `true` | Extract historical timeline interest scores. |
| `extractInterestByRegion` | Boolean | `true` | Extract regional geographical distribution. |
| `extractRelatedQueries` | Boolean | `true` | Extract Top and Rising related search queries. |
| `extractRelatedTopics` | Boolean | `true` | Extract Top and Rising related topic categories. |
| `proxyConfiguration` | Object | `{ "useApifyProxy": true }` | Apify Proxy configuration settings. |

***

### 📤 Output Data Format

Each dataset record contains comprehensive trend metrics for a keyword:

```json
{
  "term": "Artificial Intelligence",
  "geo": "Worldwide",
  "timeframe": "today 12-m",
  "interestOverTime": [
    {
      "timestamp": "1700352000",
      "date": "Nov 19, 2023",
      "value": 85,
      "formattedValue": "85",
      "hasData": true
    }
  ],
  "interestByRegion": [
    {
      "geoCode": "SG",
      "geoName": "Singapore",
      "value": 100,
      "formattedValue": "100"
    },
    {
      "geoCode": "AE",
      "geoName": "United Arab Emirates",
      "value": 88,
      "formattedValue": "88"
    }
  ],
  "relatedQueries": {
    "top": [
      {
        "query": "chat gpt",
        "value": 100,
        "formattedValue": "100"
      }
    ],
    "rising": [
      {
        "query": "deepseek ai",
        "value": 4500,
        "formattedValue": "Breakout"
      }
    ]
  },
  "relatedTopics": {
    "top": [
      {
        "query": "Technology",
        "value": 100,
        "type": "Topic"
      }
    ],
    "rising": [
      {
        "query": "Generative artificial intelligence",
        "value": 1200,
        "type": "Field of study"
      }
    ]
  },
  "scrapedAt": "2026-11-09T13:50:00.000Z"
}
```

***

### 💡 Practical Use Cases

1. **SEO & Content Marketing**: Identify explosive "Breakout" keywords before they saturate Google organic results.
2. **Product & Market Research**: Compare brand awareness and consumer interest trajectory across competing products.
3. **E-commerce Trend Scouting**: Uncover high-growth product categories and seasonal demand shifts across different countries.
4. **Financial & Investment Sentiment**: Track macro attention and sentiment cycles on commodities, cryptocurrencies, and tech innovations.

***

### ⚖️ License

Apache-2.0

# Actor input Schema

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

List of keywords or topics to analyze on Google Trends (e.g. 'Artificial Intelligence', 'Bitcoin', 'Electric Cars').

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

Country code (e.g. 'US', 'GB', 'DE', 'FR', 'SA', 'CA') or leave empty for Worldwide.

## `timeframe` (type: `string`):

Historical duration to analyze.

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

Language code for query and topic names (e.g. 'en', 'es', 'fr', 'de', 'ar').

## `extractInterestOverTime` (type: `boolean`):

Extract historical timeline interest scores (0-100).

## `extractInterestByRegion` (type: `boolean`):

Extract regional sub-entity interest distribution.

## `extractRelatedQueries` (type: `boolean`):

Extract Top and Rising (Breakout) related searches.

## `extractRelatedTopics` (type: `boolean`):

Extract Top and Rising related topic categories.

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

Use Apify Proxy to bypass rate-limits and regional blocks.

## Actor input object example

```json
{
  "searchTerms": [
    "Artificial Intelligence",
    "ChatGPT"
  ],
  "geo": "",
  "timeframe": "today 12-m",
  "hl": "en",
  "extractInterestOverTime": true,
  "extractInterestByRegion": true,
  "extractRelatedQueries": true,
  "extractRelatedTopics": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Scraped records stored in the default Apify dataset.

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

High-level summary report and execution metrics stored in Key-Value store.

# 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",
        "ChatGPT"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("khnaami/actor-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",
        "ChatGPT",
    ] }

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

```

## MCP server setup

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