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

Interest over time, interest by region and related (top + rising) queries from Google Trends for any search terms. Failed terms are never charged.

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

## Pricing

from $2.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

Get Google Trends data for any list of search terms:

- **Interest over time**: the 0-100 curve for each term (hourly to monthly points, depending on the range).
- **Interest by region**: countries, or sub-regions when you pick a country.
- **Related queries**: the top and rising searches around each term.

Compare up to 5 terms on one shared scale (like the Trends page), or check each term on its own scale.
Any time range from the past hour to 2004-present, any country, category and search type (web, images, news, YouTube, Shopping).

**You only pay for results.** A term Google refuses after all retries is reported in the dataset with the reason, free of charge.

### Input

```json
{ "searchTerms": ["bitcoin", "ethereum"], "compareTerms": true, "geo": "US", "timeRange": "today 12-m" }
```

### Output (one item per term and section)

```json
{ "type": "interestOverTime", "searchTerm": "bitcoin", "geo": "US", "timeRange": "today 12-m",
  "comparedWith": ["bitcoin", "ethereum"], "points": [{ "date": "Oct 19 - 25, 2025", "time": 1760832000, "value": 71, "partial": false }] }
```

`type` is `interestOverTime`, `interestByRegion` (`regions`), `relatedQueries` (`top`, `rising`) or `error` (not charged).

### Notes

- Values are Google's relative 0-100 interest, not search volumes.
- Related topics are not offered: Google currently returns them empty for every term.
- Data comes from the public JSON endpoints behind the Trends page; robots.txt does not disallow them.

### Development

`python -m pytest` (fixtures in `tests/fixtures` are recorded live answers). Local run: put an input in
`storage/key_value_stores/default/INPUT.json` with `"proxyConfiguration": {"useApifyProxy": false}` and run `python src/__main__.py`.

# Actor input Schema

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

Search terms to look up, e.g. \["bitcoin", "ethereum"]. Up to 100 per run. Each term gives up to 3 results (one per enabled section).

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

On: terms are compared in groups of 5, so values share one 0-100 scale (like the Trends page). Off: each term gets its own scale.

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

ISO country or region code, e.g. US, DE, US-CA. Empty = worldwide.

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

Period the values cover. Google picks the point spacing (minutes for short ranges, weeks or months for long ones).

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

Google Trends category ID, e.g. 0 = all categories, 7 = Finance.

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

Which Google search the interest comes from.

## `interestOverTime` (type: `boolean`):

One result per term: the 0-100 interest series over the time range.

## `interestByRegion` (type: `boolean`):

One result per term: interest per country, or per region inside the chosen country.

## `relatedQueries` (type: `boolean`):

One result per term: top and rising related search queries.

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

Language code for region names and related queries, such as en-US or de.

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

Google blocks busy IPs; the Apify proxy spreads requests.

## Actor input object example

```json
{
  "searchTerms": [
    "bitcoin",
    "ethereum"
  ],
  "compareTerms": false,
  "geo": "",
  "timeRange": "today 12-m",
  "category": 0,
  "searchProperty": "web",
  "interestOverTime": true,
  "interestByRegion": true,
  "relatedQueries": true,
  "language": "en-US",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

One item per search term and section (interestOverTime, interestByRegion, relatedQueries); failed term groups appear as free error items.

# 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": [
        "bitcoin",
        "ethereum"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kan3ky/google-trends").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": [
        "bitcoin",
        "ethereum",
    ] }

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

```

## MCP server setup

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

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/8GkE4tJAzNqoz4mAM/builds/9pOgnFqP1h6gD9TbM/openapi.json
