# Google Trends Scraper & API (`messy_tangerine/google-trends`) Actor

Get Google Trends data for hundreds of keywords: interest over time, related queries, regions and trending searches, plus real Wikipedia page views. No time-outs; pay only for data delivered.

- **URL**: https://apify.com/messy_tangerine/google-trends.md
- **Developed by:** [Cass](https://apify.com/messy_tangerine) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 keywords

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 API: interest over time, related queries, trending now, with Wikipedia views and news

**Google Trends** data for hundreds of keywords in one run: interest over time, related queries (top, rising, breakout), regions, trending searches, plus real numbers next to Trends' relative 0–100 scale: **Wikipedia pageviews** and **autocomplete suggestions**, and optional **news coverage** with your own NewsData.io key. Plain HTTP, no browser. It never times out, and you pay only for data delivered.

**Daily self-test:** 11 field-level checks on 10 fixed keywords every morning. Last pass: **2026-11-02** (11/11 checks on both golden runs).

### What you get

One row per keyword, summary fields first (real output, series trimmed):

```json
{
  "keyword": "coffee",
  "geo": "US",
  "timeframe": "past-12-months",
  "status": "ok",
  "latestValue": 69,
  "average": 79.02,
  "changePct": 3.8,
  "peakDate": "2026-04-05",
  "isBreakout": false,
  "timeline": [
    { "date": "2026-10-11", "value": 71, "isPartial": false },
    { "date": "2026-10-18", "value": 69, "isPartial": false },
    { "date": "2026-10-25", "value": 63, "isPartial": true }
  ],
  "relatedQueries": {
    "top": [{ "query": "coffee near me", "value": 100 }, { "query": "coffee shop", "value": 86 }],
    "rising": [{ "query": "pet care tips", "value": 6100, "growth": "Breakout", "isBreakout": true }]
  },
  "wikipedia": { "article": "Coffee", "matchConfidence": "search-top-hit", "totalViews": 687268, "dailyViews": [{ "date": "2026-10-30", "views": 1973 }] },
  "scale": { "anchorTerm": "coffee", "factor": 1, "precision": "exact" },
  "fetchedAt": "2026-10-31T09:53:12.111Z"
}
```

- **Summary fields:**
  - `latestValue` is the last complete point.
  - `changePct` compares the mean of the last quarter of the period with the first quarter.
  - `isBreakout` is true for growth over 5000%, Trends' own breakout rule.
- **Prefer a spreadsheet?** Set `rowShape: "keywordDate"` for one flat row per keyword and date, with related queries, regions, suggestions and news as their own rows.
- **Every row carries:** `status` (`ok` / `partial` / `incomplete` / `error`), a one-sentence `error` when something's missing, `scale`, and `fetchedAt`.

#### Sections (each billed only when delivered)

| Section | What it adds |
|---|---|
| Interest over time | Always included. Any timeframe: past hour to 2004–now, or a custom range |
| `relatedQueries` | Top and rising queries, with the breakout flag |
| `regions` | Countries, subregions, metro areas or cities, top first (`regionResolution`; automatic picks the level below your region) |
| `wikipediaPageviews` | Daily views of the matching article. Trends topic IDs (`/m/…`) match exactly through Wikidata |
| `news` | With **your own NewsData.io key**: a free key gives the latest articles (48 h); paid plans add daily news volume and a **spike explainer** (top articles for each Trends peak, plus that day's Wikipedia views). You pay NewsData directly; the key is never logged or saved |
| `suggestions` | Up to 10 Google and/or YouTube autocomplete suggestions |

**Trending now:** set `trendingCountries` (e.g. `["US", "IN"]`) for currently trending searches with volume, increase, related queries, categories and an explore link. Optionally add recent news articles with images (with your NewsData.io key; a free key works). You can use it alone or alongside keywords.

### Why this one

- **Never times out.** The actor watches its own deadline and stops early. Keywords it didn't reach come back as `incomplete` rows, which aren't charged, and the run still succeeds.
- **No platform fees on top.** You pay per delivered result, nothing else. Error rows and incomplete rows are free.
- **Handles blocks itself.** It warms each session, paces requests, retires blocked sessions, and switches to residential IPs when Google blocks datacenter ranges (on by default, no extra charge to you). A circuit breaker stops runs that can't succeed, instead of burning your budget.
- **Fails loudly.** Empty data becomes an error row with a reason, never a silent empty success.
- **More than Trends:** absolute Wikipedia views and autocomplete in the same row, plus news when you bring a NewsData.io key.
- **Many keywords on one scale** (`scale: "shared"`): overlapping 5-term comparisons, chained. Every row says `exact` or `chained`, and low-precision points are flagged.
- **Survives server migrations:** progress is saved and resumed.

### The input most people need

```json
{
  "keywords": ["coffee", "tea", "matcha"],
  "geo": ["US"],
  "timeframe": "past-12-months"
}
```

That's it. Related queries and Wikipedia pageviews are on by default. Other inputs:

- **`trendsUrls`:** paste Google Trends explore URLs. Region, timeframe, search type and category are read from each URL.
- **`searchType`:** web, images, news, YouTube or Shopping.
- **`category`:** a Trends category ID.
- **`sections`:** pick the extra data.

### Pricing

Pay per event: you're charged only for what's delivered.

| Event | Price (Free tier) | When |
|---|---|---|
| `apify-actor-start` | $0.001 | Once per run (per GB of memory; the default 256 MB counts once) |
| `keyword-timeline` | $0.002 | Per keyword × region delivered |
| `related-queries` | $0.001 | Delivered and not empty |
| `regions` | $0.001 | Delivered and not empty |
| `wikipedia-views` | $0.0005 | Article matched and views returned |
| `news-coverage` | $0.0005 | News delivered from your NewsData.io key (NewsData's own fees are yours) |
| `suggestions` | $0.0005 | Per source (Google / YouTube) delivered |
| `trending-item` | $0.0005 | Per trending search returned |
| `date-rows` | $0.001 | Per started 100 rows, `keywordDate` shape only |

Higher Apify plans pay less (Silver about 20% off, Gold about 40% off).

**Worked examples (Free tier):**

- **100 keywords**, timeline + related queries: $0.001 + 100 × ($0.002 + $0.001) = **$0.30**.
- **One full report** (timeline, related queries, regions, Wikipedia, Google suggestions): $0.001 + $0.002 + $0.001 + $0.001 + $0.0005 + $0.0005 = **$0.006** (+ $0.0005 with news from your NewsData.io key).
- **Trending now**, 25 items for one country: $0.001 + 25 × $0.0005 = **$0.0135**.

Set **Maximum cost per run** in the run options: the actor checks it before every keyword and never fetches data it can't bill.

### Use it from Claude, Cursor or ChatGPT (MCP)

Apify's MCP server exposes this actor as a tool, so an AI agent can call it directly.

- **Hosted:** add the MCP server `https://mcp.apify.com/?actors=messy_tangerine/google-trends` in your client and sign in with Apify.
- **Local** (Claude Desktop, Cursor):

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--actors", "messy_tangerine/google-trends"],
      "env": { "APIFY_TOKEN": "<your token>" }
    }
  }
}
```

**Faster single lookups (Standby):** `GET https://messy-tangerine--google-trends.apify.actor/?keyword=coffee&geo=US&timeframe=past-90-days` with your Apify token as a Bearer header returns one row as JSON. It answers in about 5 seconds; the first call after a quiet period takes 15–20 s while the container starts.

Agents do well with short inputs: `{"keywords": ["…"], "geo": ["US"], "timeframe": "past-90-days"}`. Every input field has a one-line description with an example, which agents read.

### FAQ

**Why do my numbers differ a little from the Trends website?**
Google samples Trends data, so values can shift a few points between pulls on different days. Pulls of the same query on the same day matched exactly in our tests (530 of 530 points from two different IPs). Compare same-day pulls, and use `fetchedAt`.

**Can I compare more than 5 terms?**
Trends compares at most 5 at once. With `scale: "shared"`, the actor ranks your keywords, then chains overlapping 5-term groups through a shared bridge term. Rows say `precision: "chained"`. A 20-keyword ranking came out identical in two same-day runs.

**How precise are chained values?**
Trends rounds to whole numbers within each comparison. A value of 3 can mean anything from 2.5 to 3.5 (±17%), and chaining carries that rounding forward. Points under 5 in their group get `lowPrecision: true`. Keywords far apart in volume (e.g. "weather" vs a niche term) are the least precise. For the most precise numbers, put up to 5 terms in one Trends URL: that's a direct comparison, `precision: "exact"`.

**Is this legal? Where does the data come from?**
The actor reads public Google Trends pages over plain HTTP, the same data the website shows. It doesn't log in and doesn't bypass any paywall. Add-on data comes from public APIs: Wikimedia (pageviews, Wikidata) and Google autocomplete; news comes from NewsData.io under your own key and their terms. You're responsible for how you use the data. If in doubt about your use case, ask your lawyer.

**How do I schedule it?**
Save your input as an Apify task, then add a schedule (for example, daily at 06:00 in your time zone) in Apify Console → Schedules. Each run's dataset is kept, so you build a history. Use webhooks or integrations to push results to Sheets, Slack or your database.

**What about related topics?**
Not offered. Google returns related topics empty for sessions that aren't logged in (we checked 11 query variants), and we don't sell what we can't deliver.

### Known limits

| Limit | How we handle it |
|---|---|
| Google samples Trends data; values can shift a few points between days | `fetchedAt` on every row; compare same-day pulls |
| No absolute search volume (Trends is relative 0–100) | Wikipedia pageviews give a real number next to it |
| Chained scales lose precision for small terms | `precision` field, `lowPrecision` flags; up to 5 terms per URL stay exact |
| Related topics are empty for logged-out sessions | Not offered |
| Google sometimes blocks whole datacenter IP ranges | Automatic residential fallback (default on); circuit breaker; error rows say so |
| Unofficial endpoints can change | Daily self-test, fixes within 24 hours |
| News needs your own NewsData.io key; a free key covers only the last 48 hours | Rows say so (`access: "latest"`); paid plans add daily volume (last 50 days of your range) and spike articles back to their archive depth |
| City-level regions are sparse (e.g. 46 of 200 US cities had data for "coffee"; none for Maharashtra) | Cities without data are dropped; an empty list is `partial` with a reason, not charged |
| Wikipedia matching for plain text uses title search | `matchConfidence` says how sure the match is; set `wikipediaLanguage` for non-English keywords; use topic IDs for exact matches |

### Data credits

- **Google Trends** (trends.google.com): search interest data.
- **Wikimedia:** pageviews (Wikimedia REST API) and Wikidata (CC0). Wikipedia is a trademark of the Wikimedia Foundation; this actor isn't affiliated with it.
- **NewsData.io:** news articles and counts, fetched with your own API key under NewsData's terms. Rows with news carry an `attribution` field.

### Changelog

See [CHANGELOG.md](CHANGELOG.md).

# Changelog

This Actor's version history is a separate document: https://apify.com/messy_tangerine/google-trends/changelog.md

# Actor input Schema

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

Search terms or Trends topic IDs to report on, for example \["coffee", "/m/02vqfm"]. Up to 500 per run. Needed unless you give Trends URLs.

## `trendsUrls` (type: `array`):

Google Trends explore URLs to run as they are, for example \["https://trends.google.com/trends/explore?q=coffee,tea\&geo=US"]. Region, timeframe, search type and category come from each URL; terms in one URL share one scale.

## `scale` (type: `string`):

How values compare across keywords, for example "shared" to rank 50 keywords on one scale. Shared scale chains overlapping 5-term comparisons and marks low-precision values.

## `geo` (type: `array`):

Country or subregion codes, each run as its own report, for example \["US", "IN-MH"]. Leave empty for worldwide.

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

Time range of the report, for example "past-12-months". Choose "custom" to use startDate and endDate.

## `startDate` (type: `string`):

First day of a custom range in YYYY-MM-DD, for example "2024-01-01". Used only when timeframe is "custom".

## `endDate` (type: `string`):

Last day of a custom range in YYYY-MM-DD, for example "2024-03-31". Used only when timeframe is "custom".

## `searchType` (type: `string`):

Which Google search to measure, the same options as on the Trends page, for example "youtube".

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

Trends category ID to narrow the data, for example 71 for Food & Drink. 0 means all categories.

## `sections` (type: `array`):

Sections to add next to interest over time (always included), for example \["relatedQueries", "regions"]. Each is billed only when delivered. News needs your own NewsData.io API key in newsApiKey.

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

Which level the regions section returns, for example "CITY" for cities in a country. Automatic picks the level below the region you chose.

## `suggestionSources` (type: `array`):

Where autocomplete suggestions come from when the suggestions section is on, for example \["google", "youtube"]. Each source is billed separately.

## `suggestionsLanguage` (type: `string`):

Language for autocomplete suggestions, for example "hi" for Hindi.

## `newsApiKey` (type: `string`):

Your own key from newsdata.io, needed for the news section and trending news, for example "pub_123…". A free key gives the last 48 hours of articles; paid plans add daily news volume and articles for each Trends spike. You pay NewsData directly; the key is never logged or saved in results.

## `rowShape` (type: `string`):

How results are laid out, for example "keywordDate" for one flat row per date that opens well in a spreadsheet. keywordDate adds a small date-rows charge per 100 rows.

## `wikipediaLanguage` (type: `string`):

Language edition used to match keywords to Wikipedia articles and count pageviews, for example "de".

## `trendingCountries` (type: `array`):

Countries to list currently trending searches for, for example \["US", "IN"]. Leave empty to skip trending mode.

## `trendingHours` (type: `string`):

How far back trending searches go, for example "24" for the past day.

## `trendingCategories` (type: `array`):

Only trends in these categories, for example \[17] for Sports (1 Autos, 3 Business, 4 Entertainment, 7 Health, 10 Law and Government, 14 Politics, 17 Sports, 18 Technology). Empty means all.

## `trendingMaxItems` (type: `integer`):

Most trending searches to return per country, biggest first, for example 25. Each item is billed.

## `trendingActiveOnly` (type: `boolean`):

If true, leave out trends that have already ended, for example true for a live dashboard.

## `trendingNews` (type: `boolean`):

If true, attach up to 5 recent news articles (with images) per trend from NewsData.io, for example true for a news digest. Needs newsApiKey; a free key works.

## `proxy` (type: `object`):

Apify Proxy settings, for example {"useApifyProxy": true} for datacenter IPs, which work well for Google Trends.

## `allowResidentialFallback` (type: `boolean`):

If true, new sessions switch to residential proxies after repeated blocks on datacenter IPs, for example false to stay on datacenter only. Google sometimes blocks whole datacenter ranges; the fallback keeps the run working at no extra charge to you.

## `mode` (type: `string`):

Leave as "keyword". The probe modes check the Trends endpoints and store status codes in the key-value store.

## `debugGroupSize` (type: `integer`):

Leave at 5. Smaller values force chaining for accuracy checks, for example 3.

## Actor input object example

```json
{
  "keywords": [
    "coffee",
    "tea"
  ],
  "trendsUrls": [],
  "scale": "independent",
  "geo": [],
  "timeframe": "past-12-months",
  "searchType": "web",
  "category": 0,
  "sections": [
    "relatedQueries",
    "wikipediaPageviews"
  ],
  "regionResolution": "auto",
  "suggestionSources": [
    "google"
  ],
  "suggestionsLanguage": "en",
  "rowShape": "keyword",
  "wikipediaLanguage": "en",
  "trendingCountries": [],
  "trendingHours": "24",
  "trendingCategories": [],
  "trendingMaxItems": 25,
  "trendingActiveOnly": false,
  "trendingNews": false,
  "proxy": {
    "useApifyProxy": true
  },
  "allowResidentialFallback": true,
  "mode": "keyword",
  "debugGroupSize": 5
}
```

# Actor output Schema

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

One row per keyword and region with summary fields first: latest value, average, change %, peak date, breakout flag, Wikipedia views, status and error.

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

Every row with every field: full timelines, related queries, regions, suggestions, news and scale information.

## `trending` (type: `string`):

Trending searches per country (only when trendingCountries was set).

## `runSummary` (type: `string`):

Counts of ok, partial, failed and incomplete keywords, requests, blocks and events charged.

# 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": [
        "coffee",
        "tea"
    ],
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("messy_tangerine/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 = {
    "keywords": [
        "coffee",
        "tea",
    ],
    "proxy": { "useApifyProxy": True },
}

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

```

## MCP server setup

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