# Google Trends Scraper - Fast, Pay Only for Results (`dyalaalsharif/google-trends-scraper`) Actor

Get Google Trends data for any keyword in seconds: interest over time, interest by region, related queries and topics (top + rising), and today's trending searches by country. Automatic retries, spreadsheet-friendly output, and you never pay for terms that fail.

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

## Pricing

from $2.50 / 1,000 trend reports

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 — Fast, Pay Only for Results

Get **Google Trends data for any keyword** in seconds: interest over time, interest by region, related queries, related topics, and today's **trending searches by country**. Export to JSON, CSV, Excel or Google Sheets, or call it from the API, n8n, Make, Zapier or your AI agent.

**You only pay for terms that return data.** If Google has no data for a term, or a request fails after all retries, you are not charged for it.

### What you get

| Data | Details |
|---|---|
| 📈 **Interest over time** | Search interest (0–100) for every day, week or month in your time range, with a flag for incomplete (partial) periods |
| 🗺️ **Interest by region** | Countries, regions/states, cities or US metro areas |
| 🔍 **Related queries** | Top and **rising** searches, including "Breakout" terms |
| 🧩 **Related topics** | Top and rising topics with their type (e.g. "Drink", "Company") |
| 🔥 **Trending now** | Today's trending searches in any country, with approximate search volume and related news articles |
| ⚖️ **Compare** | Up to 5 terms side by side, exactly like Compare on Google Trends |

### Why this scraper

- **Fast** — a typical term finishes in a few seconds, not minutes.
- **Reliable** — automatic retries with fresh sessions, and automatic switch to residential proxies if Google starts blocking.
- **Fair pricing** — charged per term that returns data. Failed terms are free and clearly marked in the output.
- **Spreadsheet friendly** — choose *Flat rows* to get one row per data point, ready for Excel or Google Sheets.
- **Any country, any language** — use any country or region code (US, GB, AE, SA, US-CA…) and topic names in your language.

### Use cases

- **SEO & content planning** — find rising queries before they peak.
- **E-commerce & product research** — check if demand for a product is growing, seasonal or fading.
- **Market research** — compare brands, products or ideas by country.
- **News & social media** — monitor what people are searching for today in any country.
- **AI agents & dashboards** — schedule daily runs and feed fresh trend data to your tools.

### How to use

1. Add one or more **Search terms** (e.g. `coffee`, `matcha`).
2. Optionally set a **country code** (e.g. `US`) and a **time range**.
3. Pick the **data to collect**.
4. Click **Start**. Download results as JSON, CSV, Excel, or connect them to your apps.

Want today's trending searches only? Leave search terms empty and add countries under **Trending now: countries**.

### Input example

```json
{
  "searchTerms": ["coffee", "matcha"],
  "compareTerms": true,
  "geo": "US",
  "timeRange": "today 12-m",
  "dataTypes": ["interestOverTime", "interestByRegion", "relatedQueries"],
  "trendingNowCountries": ["US", "GB"]
}
```

### Output example (report format)

```json
{
  "searchTerm": "coffee, matcha",
  "geo": "US",
  "timeRange": "today 12-m",
  "interestOverTime": [
    { "date": "2025-10-19", "isPartial": false, "coffee": 65, "matcha": 18 }
  ],
  "interestByRegion": [
    { "geoCode": "US-WY", "geoName": "Wyoming", "coffee": 71, "matcha": 29 }
  ],
  "relatedQueries": {
    "coffee": {
      "top": [{ "query": "coffee near me", "value": 100 }],
      "rising": [{ "query": "cowboy coffee", "value": 180, "formattedValue": "+180%" }]
    }
  },
  "trendsUrl": "https://trends.google.com/trends/explore?q=coffee,matcha&geo=US"
}
```

Trending now items look like this:

```json
{
  "type": "trendingNow",
  "geo": "US",
  "rank": 1,
  "title": "example trending search",
  "approxTraffic": "200,000+",
  "news": [{ "title": "Headline", "url": "https://...", "source": "Publisher" }]
}
```

### Pricing

Pay per event:

- **Trend report** — one per search term (or per comparison group of up to 5 terms) that returned data.
- **Trending search** — one per trending-now item returned.

Terms with no data and failed requests are **not charged**. Platform usage is included.

### Good to know

- Google Trends values are **relative** (0–100), not absolute search counts. In comparisons, values are relative to all terms in the group.
- Very rare terms may have no data. They appear in the output with `"noData": true` and are not charged.
- Custom time range format: `YYYY-MM-DD YYYY-MM-DD`.
- Common category IDs: 71 Food & Drink, 18 Shopping, 12 Business & Industrial, 3 Arts & Entertainment, 5 Computers & Electronics.

### Is it legal?

This Actor collects publicly available, aggregated and anonymous trend data. It does not collect personal data. You are responsible for using the data in line with applicable laws and Google's terms.

### Feedback

Found a problem or want a feature? Open an issue on the **Issues** tab — it gets answered quickly.

# Actor input Schema

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

Keywords to look up on Google Trends. Each term gets its own report, unless you turn on 'Compare terms'.

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

Put terms side by side in groups of up to 5, like the Compare feature on Google Trends. Values are then relative to each other.

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

Two-letter country code such as US, GB, AE, SA, or a region code such as US-CA. Leave empty for worldwide.

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

Period to analyze. Ignored when a custom time range is set.

## `customTimeRange` (type: `string`):

Optional. Exact dates as 'YYYY-MM-DD YYYY-MM-DD', for example '2025-01-01 2025-06-30'.

## `dataTypes` (type: `array`):

Choose which Google Trends sections to collect for each term.

## `trendingNowCountries` (type: `array`):

Optional. Two-letter country codes (e.g. US, GB, AE) to get today's trending searches, with traffic estimates and related news. Works without search terms.

## `maxTrendingPerCountry` (type: `integer`):

0 means all available (usually 10-30).

## `outputFormat` (type: `string`):

'Report' gives one item per term with all sections inside. 'Flat rows' gives one row per data point, best for Excel and Google Sheets.

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

Which search to analyze.

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

Google Trends category number. 0 means all categories. Examples: 71 Food & Drink, 3 Arts & Entertainment, 12 Business & Industrial, 18 Shopping.

## `regionResolution` (type: `string`):

Level of detail for 'Interest by region'. Leave as automatic unless you need cities or metro areas.

## `includeLowVolumeRegions` (type: `boolean`):

Also return regions with little search volume.

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

Language for topic names, e.g. en-US, ar, fr, de, es.

## `maxConcurrency` (type: `integer`):

How many terms to process at once. Higher is faster but more likely to be rate-limited by Google.

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

Proxy servers used to reach Google. The default works for most runs.

## `residentialFallback` (type: `boolean`):

If Google keeps blocking, automatically retry through residential proxies. Recommended.

## Actor input object example

```json
{
  "searchTerms": [
    "coffee",
    "matcha"
  ],
  "compareTerms": false,
  "geo": "",
  "timeRange": "today 12-m",
  "dataTypes": [
    "interestOverTime",
    "interestByRegion",
    "relatedQueries",
    "relatedTopics"
  ],
  "trendingNowCountries": [],
  "maxTrendingPerCountry": 0,
  "outputFormat": "report",
  "property": "",
  "category": 0,
  "regionResolution": "",
  "includeLowVolumeRegions": false,
  "language": "en-US",
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": 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 = {
    "searchTerms": [
        "coffee",
        "matcha"
    ]
};

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

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

```

## MCP server setup

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