# Google Trends Multi-Country Interest Scraper (`mellora/google-trends-multi-country-scraper`) Actor

Extracts Google Trends interest-over-time, related queries and topics for any keyword across countries, regions and languages in one run.

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

## Pricing

$1.10 / 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 Multi-Country Interest Scraper

Compare how much people search for a keyword across many countries and languages in a single run. Give it keywords, country codes and language codes, and get one dataset item per keyword/country/language combination with interest over time, related queries, related topics and optional regional breakdown. Good for international SEO, market research and content planning.

### Sample output (format)

Values below are illustrative of the structure; real values depend on the live data.

```json
{
  "keyword": "python",
  "country": "DE",
  "language": "en-US",
  "timeframe": "today 12-m",
  "category": 0,
  "property": "web",
  "timeline": [
    {"timestamp": 1717286400, "date": "Jun 2, 2024", "value": 71, "isPartial": false}
  ],
  "averageInterest": 68.4,
  "peakInterest": 100,
  "relatedQueries": {
    "top": [{"query": "python tutorial", "value": 100, "formattedValue": "100"}],
    "rising": [{"query": "python 3.13", "value": 250, "formattedValue": "+250%"}]
  },
  "relatedTopics": {
    "top": [{"title": "Python", "type": "Programming language", "value": 100, "formattedValue": "100"}],
    "rising": []
  },
  "sourceUrl": "https://trends.google.com/trends/explore?q=python&geo=DE&hl=en-US"
}
```

### Input

- **keywords** (required): up to 50 terms.
- **countries**: ISO codes such as `US`, `GB`, `DE`, sub-regions such as `US-CA`, or `WORLDWIDE`.
- **languages**: `hl` codes such as `en-US`, `de`, `fr-FR`.
- **timeframe**: preset (past hour to 2004-present) or custom `YYYY-MM-DD YYYY-MM-DD`.
- **property**: web, images, news, YouTube or Shopping.
- **category**: Google Trends category ID (0 = all).
- **includeRelated**, **includeRegional**: optional extra sections.
- **maxResults**: cap on combinations (default 50).
- **useProxyFallback**: retry through Apify proxy if Google rate limits direct requests.

### Output

One dataset item per combination: timeline (0-100 relative interest), average and peak interest, related queries and topics (top and rising), optional regional interest, and a link to the matching public Trends page.

### Pricing

$0.001 per result (one result = one keyword/country/language combination). Combinations that fail are not pushed and not charged.

### Limits

- Reads only public Google Trends data, no login.
- Interest values are relative (0-100), as on Google Trends, and are normalized per combination, so values are not directly comparable across different combinations.
- Google rate limits aggressively. The Actor waits between requests, backs off on 429 responses, and may switch to proxy. Large batches can take a while.
- No CAPTCHA solving. If Google keeps blocking, the run fails with a clear message; retry later.

# Actor input Schema

## `keywords` (type: `array`):

Search terms to look up (max 50). Each keyword is checked separately in every country and language you choose.

## `countries` (type: `array`):

ISO country codes (US, GB, DE) or sub-regions (US-CA). Leave a blank entry or use WORLDWIDE for global data.

## `languages` (type: `array`):

Language codes (hl) such as en-US, de, fr-FR. This affects topic and related-query labels.

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

Time range for the data. You can also type a custom range as 'YYYY-MM-DD YYYY-MM-DD'.

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

Which Google property to measure interest on.

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

Google Trends category ID. 0 means all categories.

## `includeRelated` (type: `boolean`):

Adds top and rising related queries and topics. Makes each combination a few requests slower.

## `includeRegional` (type: `boolean`):

Adds interest broken down by sub-region (or by country for worldwide).

## `maxResults` (type: `integer`):

Upper limit on keyword x country x language combinations processed (1-1000). Each combination is one billed result.

## `useProxyFallback` (type: `boolean`):

If Google rate limits direct requests, retry through Apify residential proxy.

## Actor input object example

```json
{
  "keywords": [
    "python",
    "rust"
  ],
  "countries": [
    "US",
    "GB",
    "DE"
  ],
  "languages": [
    "en-US"
  ],
  "timeframe": "today 12-m",
  "property": "",
  "category": 0,
  "includeRelated": true,
  "includeRegional": false,
  "maxResults": 50,
  "useProxyFallback": true
}
```

# 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 = {
    "keywords": [
        "python",
        "rust"
    ],
    "countries": [
        "US",
        "GB",
        "DE"
    ],
    "languages": [
        "en-US"
    ],
    "timeframe": "today 12-m",
    "property": "",
    "category": 0,
    "includeRelated": true,
    "includeRegional": false,
    "maxResults": 50,
    "useProxyFallback": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("mellora/google-trends-multi-country-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 = {
    "keywords": [
        "python",
        "rust",
    ],
    "countries": [
        "US",
        "GB",
        "DE",
    ],
    "languages": ["en-US"],
    "timeframe": "today 12-m",
    "property": "",
    "category": 0,
    "includeRelated": True,
    "includeRegional": False,
    "maxResults": 50,
    "useProxyFallback": True,
}

# Run the Actor and wait for it to finish
run = client.actor("mellora/google-trends-multi-country-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 '{
  "keywords": [
    "python",
    "rust"
  ],
  "countries": [
    "US",
    "GB",
    "DE"
  ],
  "languages": [
    "en-US"
  ],
  "timeframe": "today 12-m",
  "property": "",
  "category": 0,
  "includeRelated": true,
  "includeRegional": false,
  "maxResults": 50,
  "useProxyFallback": true
}' |
apify call mellora/google-trends-multi-country-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mellora/google-trends-multi-country-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/D2rpRIWFE1GfU5x7J/builds/O6RkfMa8hNlUfs0PE/openapi.json
