# Google Trends Scraper - Interest Over Time & Related Queries (`sweet_stickball/google-trends-scraper`) Actor

Scrape Google Trends: interest over time and related queries for up to 5 compared keywords, by country, time range and category. Google Trends API alternative for keyword and trend research.

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

## Pricing

from $1.30 / 1,000 trend queries

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Over Time & Related Queries

Pull **interest over time**, **related queries**, and **related topics** from Google Trends for a search term, or compare up to 5 terms side by side. No API key and no headless browser: the actor calls the same JSON endpoints the Google Trends website uses.

### Features

- **Multi-term comparison** — compare up to 5 keywords in a single run, with per-term interest scores
- **Regional filtering** — narrow results to a country, or leave blank for worldwide data
- **Time ranges** — from the past hour to the past 5 years
- **Category filter** — optional Google Trends category ID
- **One JSON object per run** — ready for spreadsheets, dashboards, or AI/LLM pipelines
- **Retries** — requests go through Apify Proxy (datacenter, then residential); when Google rate-limits a request (HTTP 429) the actor waits and retries with a new proxy session

### Input

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `query` | string | Yes | — | Search term or comma-separated terms (max 5) |
| `geo` | string | No | `""` | Two-letter country code (empty = worldwide) |
| `timeRange` | string | No | `"today 12-m"` | Time range (see options below) |
| `category` | integer | No | `0` | Category ID (0 = all categories) |

#### Time Range Options

| Value | Period |
|-------|--------|
| `now 1-H` | Past hour |
| `now 4-H` | Past 4 hours |
| `now 1-d` | Past day |
| `now 7-d` | Past 7 days |
| `today 1-m` | Past month |
| `today 3-m` | Past 3 months |
| `today 12-m` | Past 12 months |
| `today 5-y` | Past 5 years |

### Output

One flat JSON object per run with all trend data embedded:

```json
{
    "query": "python, javascript",
    "queries": ["python", "javascript"],
    "geo": "US",
    "timeRange": "today 12-m",
    "interestOverTime": [
        {"date": "2024-01-07", "formattedDate": "Jan 7 – 13, 2024", "values": [75, 60], "formattedValues": ["75", "60"], "isPartial": false}
    ],
    "relatedQueries": [
        {"query": "python tutorial", "keyword": "python", "rankType": "top", "value": 100, "formattedValue": "100", "link": "/trends/explore?q=python+tutorial&date=today+12-m&geo=US"}
    ],
    "relatedTopics": [
        {"topic": "Python (programming language)", "topicType": "Programming language", "keyword": "python", "rankType": "top", "value": 100}
    ],
    "totalDataPoints": 52,
    "totalRelatedQueries": 25,
    "totalRelatedTopics": 25,
    "scrapedAt": "2024-12-01T10:30:00Z"
}
```

Notes:

- `relatedQueries` contains both the **top** and **rising** lists (`rankType`), one set per compared term (`keyword`). Rising values are % growth (`formattedValue` may be `Breakout`).
- `geo` is `"worldwide"` when no country is set; `date` is the UTC start of each period.

### Input Example

```json
{
    "query": "artificial intelligence,machine learning",
    "geo": "US",
    "timeRange": "today 12-m"
}
```

### Pricing

Pay-per-event, **no start fee**: **$2.10 per 1,000 trend queries** on the Apify Free plan, with lower prices on paid plans.

| Event | Free | Starter | Scale | Business | Enterprise |
|-------|------|---------|-------|----------|------------|
| Trend query (`TREND_QUERY`) | $2.10 | $1.80 | $1.60 | $1.30 | $1.30 |

Prices in USD per 1,000 events.

#### Cost examples (Free plan)

| Queries | Cost |
|---------|------|
| 1 | $0.0021 |
| 100 | $0.21 |
| 1,000 | $2.10 |

### Use cases

- **SEO & content strategy** — spot rising search terms in your niche
- **Market research** — compare brand or product interest across regions and time periods
- **Journalism & analysis** — track public interest around events, policies, or cultural moments
- **AI agent workflows** — feed structured trend data into LLM pipelines

### Limitations

- **Relative values** — interest scores are Google's relative index (0–100 within the request), not absolute search volumes.
- **Related topics often empty** — Google frequently returns no related topics for these requests; `relatedTopics` may be empty even when interest data and related queries are present.
- **Rate limits** — Google Trends rate-limits aggressively. When that happens the actor waits and retries on new proxy sessions, so a run can take up to about 1 minute; if every attempt fails, the run ends FAILED with the last error.
- **Low-volume terms** — if Google returns no interest-over-time data (too little search volume), the run ends FAILED instead of producing an empty result.
- **Max 5 terms** — extra comma-separated terms beyond the fifth are ignored. One result (and one charge) per run.

### Related Actors

- [Google News Scraper API - Articles by Keyword, No Login](https://apify.com/sweet_stickball/google-news-scraper) — Scrape Google News articles for any keyword: headlines, sources, dates and URLs by country and language. News monitoring API, no API key or login.
- [Bing Search Scraper & DuckDuckGo SERP API](https://apify.com/sweet_stickball/bing-ddg-serp) — Scrape Bing and DuckDuckGo search results: titles, URLs, snippets and positions per keyword. SERP API for rank tracking and SEO, no key and no login.
- [YouTube Transcript Scraper - Captions & Comments](https://apify.com/sweet_stickball/youtube-transcripts) — Scrape YouTube video transcripts (captions and auto-generated subtitles) with timestamps, video metadata and optional comments.

# Actor input Schema

## `query` (type: `string`):

Search term or comma-separated terms for comparison (max 5). Examples: 'artificial intelligence', 'python,javascript,rust'

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

Two-letter country code for regional data. Empty = worldwide. Examples: 'US', 'FR', 'DE'

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

Time range for trend data. Options: 'now 1-H' (past hour), 'now 4-H', 'now 1-d', 'now 7-d', 'today 1-m', 'today 3-m', 'today 12-m', 'today 5-y'

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

Google Trends category ID. 0 = all categories. See Google Trends for IDs.

## Actor input object example

```json
{
  "query": "artificial intelligence",
  "geo": "",
  "timeRange": "today 12-m",
  "category": 0
}
```

# Actor output Schema

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

Dataset items shown with the 'results' view.

# 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 = {
    "query": "artificial intelligence"
};

// Run the Actor and wait for it to finish
const run = await client.actor("sweet_stickball/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 = { "query": "artificial intelligence" }

# Run the Actor and wait for it to finish
run = client.actor("sweet_stickball/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 '{
  "query": "artificial intelligence"
}' |
apify call sweet_stickball/google-trends-scraper --silent --output-dataset

```

## MCP server setup

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