# SERP Keyword Clustering: group keywords by shared URLs (`ucchiii/serp-keyword-clustering`) Actor

Cluster keywords by overlapping Google top results from your Google Search scraper datasets, with rule-based search intent estimates. No Google access, no LLM. $2.00 per 1,000 keywords.

- **URL**: https://apify.com/ucchiii/serp-keyword-clustering.md
- **Developed by:** [Actor Factory](https://apify.com/ucchiii) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 clustered keywords

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

## SERP Keyword Clustering — group keywords by shared top URLs

SEO teams and content planners: turn a big keyword list into **topic groups** by checking which keywords Google answers
with the same URLs, so you write one page per group instead of one per keyword. It reads datasets you already have from
`apify/google-search-scraper`; no Google access, no proxies, no LLM.
**$2.00 per 1,000 keywords**. Reading datasets is free.

### Use cases

- Plan one page per topic instead of one page per keyword
- Find keyword cannibalization: keywords that share results but point to different pages
- Group a keyword research export into topics with an intent label (informational, commercial, navigational)

### How it works

1. Run **Google Search Scraper** (`apify/google-search-scraper`) on your keywords.
2. Run **this Actor** with that run's dataset ID.
3. Read one row per keyword with its cluster, parent keyword and estimated intent. A full cluster list is saved in the
   key-value store as `CLUSTERS`.

For each keyword the top N organic URLs (default 10) are compared. Two keywords with at least `minSharedUrls` (default 3)
URLs in common belong together. URLs are compared without `www`, query string, fragment or trailing slash.

- **strict** (default): the most connected keyword becomes the centre of a group, and only keywords that overlap with it
  join. Tight, focused groups.
- **loose**: connected components. Any chain of overlaps merges into one group, so groups are larger and can drift
  across topics.
- **parentKeyword**: the keyword in the group with the highest total overlap with the others.
- **Intent** (`informational`, `commercial`, `transactional`, `navigational`, `local`) is an **estimate from rules**: words
  in the keyword (buy, price, best, vs, how, near me, login, ...) plus URL patterns in the top results (/product, /shop,
  /blog, wikipedia, youtube, ...). `intentConfidence` is `low`, `medium` or `high`. Treat it as a hint, not a fact.
- Missing fields in the source data are tolerated. By default each country and device combination is clustered separately.

### Input

```json
{
  "datasetIds": ["<dataset ID of your Google Search scraper run>"],
  "topN": 10,
  "minSharedUrls": 3,
  "clusterMethod": "strict",
  "groupByCountry": true
}
```

Leave `datasetIds` empty to see a free demo on sample data (rows carry `_demo: true`).

### Output

One row per keyword:

```json
{"keyword": "buy running shoes", "clusterId": 2, "parentKeyword": "running shoes price", "clusterSize": 3,
 "sharedUrlsWithParent": 4, "intent": "transactional", "intentConfidence": "high", "countryCode": "US",
 "device": "DESKTOP", "topUrls": ["https://a.com/shop", "https://b.com/product/1", "https://c.com/store"]}
```

`sharedUrlsWithParent` is empty (null) for the parent itself. In `strict` mode a keyword is joined through the group's
centre, which can differ slightly from the parent, so its overlap with the parent may be below your threshold.

Key-value store `CLUSTERS`:

```json
[{"clusterId": 2, "parentKeyword": "running shoes price", "keywords": ["running shoes price", "buy running shoes"],
  "size": 2, "commonUrls": ["https://a.com/shop"], "countryCode": "US", "device": "DESKTOP"}]
```

`SUMMARY` holds counts (keywords, clusters, singletons) and the settings used.

### Pricing

$2.00 per 1,000 keywords written (event `keyword`, $0.002 each). The demo is free.

### Notes

This Actor only processes datasets you already own; it does not access Google. You are responsible for how the
underlying data was collected and used.

### More tools from the same developer

- [SERP Analyzer](https://apify.com/ucchiii/serp-dataset-analyzer) — rankings, share of voice and People Also Ask from Google Search scraper datasets
- [Sitemap URL Extractor](https://apify.com/ucchiii/sitemap-urls) — list every URL of a website from its sitemaps
- [Dataset Merge & Dedup](https://apify.com/ucchiii/dataset-dedup-merge) — merge Apify datasets and remove duplicates by the fields you choose
- [Google Sheets Export](https://apify.com/ucchiii/google-sheets-export) — export an Apify dataset to Google Sheets

# Actor input Schema

## `datasetIds` (type: `array`):

Dataset IDs (the 'defaultDatasetId' of a finished run of the source Actor, e.g. 'WkzbQMuFYuamGv3YF'). Datasets from your Google Search scraper runs (e.g. apify/google-search-scraper). Several runs are combined. Leave empty for a free demo on sample data.

## `topN` (type: `integer`):

Only organic results at or above this position are used to compare keywords. Allowed range 1 to 100 (default 10).

## `minSharedUrls` (type: `integer`):

Two keywords are grouped when at least this many of their top URLs are the same. Lower values make bigger, looser groups.

## `clusterMethod` (type: `string`):

'strict' (default) builds tight groups: each keyword must overlap with the group's central keyword. 'loose' joins any keywords linked by a chain of overlaps, so groups can be larger and broader.

## `groupByCountry` (type: `boolean`):

If on, keywords are clustered separately for each country and device combination, because rankings differ between them. If off, results are merged by keyword text.

## Actor input object example

```json
{
  "topN": 10,
  "minSharedUrls": 3,
  "clusterMethod": "strict",
  "groupByCountry": true
}
```

# Actor output Schema

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

One item per keyword: clusterId, parentKeyword, clusterSize, sharedUrlsWithParent, intent, intentConfidence, countryCode, device, topUrls.

## `clusters` (type: `string`):

The keyword clusters as a list.

## `summary` (type: `string`):

Run summary: counts and settings.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("ucchiii/serp-keyword-clustering").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("ucchiii/serp-keyword-clustering").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 '{}' |
apify call ucchiii/serp-keyword-clustering --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ucchiii/serp-keyword-clustering"
        }
    }
}
```

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/4yWx6ibMrj5wHU2Ix/builds/8PVxmIdaulXMNvZ90/openapi.json
