# Cookie Consent Scanner: Before, Accept and Reject (`urlwright/cookie-consent-scanner`) Actor

Scan public pages before consent, after accept and after reject. Lists cookie names, storage keys, scripts and request hosts for a cookie table. No cookie values and no login.

- **URL**: https://apify.com/urlwright/cookie-consent-scanner.md
- **Developed by:** [Urlwright](https://apify.com/urlwright) (community)
- **Categories:** Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 page scanneds

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

## Cookie Consent Scanner: Before, Accept and Reject

**Urlwright.** Little tools for the web.

See which cookies, storage keys, scripts and third party hosts a public site sets before consent, after accept and after reject. One dataset row per phase, plus a summary per domain with a flat cookie table.

The actor does not log in, fill forms, or keep a session. It never writes cookie values or storage values.

### What it does

1. You pass domains or page URLs (`startUrls`) or a dataset of URLs. `startUrls` accepts plain strings and Apify request objects `{ "url": "…" }`. Bare domains become `https://`.
2. Each target is checked for a private, link local or metadata address. A blocked URL is `ssrf-blocked` and is not opened.
3. When `respectRobotsTxt` is true (the default), the actor reads `robots.txt`, follows redirects, and caches it for the run. A disallowed path is `blocked` and is free. Crawl-delay is waited in full between pages.
4. Pages come from `sitemap.xml` when it lists enough URLs, otherwise from links on the homepage. The homepage is always included. An imprint page and a privacy page are included when the list has them. Then one URL per first path segment, up to `maxPages` (default 10, maximum 50). Login, cart and template or demo paths are skipped.
5. Each kept page is opened three times in a fresh headless window: `before_consent`, `after_accept`, `after_reject`. Accept and reject click only a visible button on the banner the actor recognised. There is no login and no stored cookie jar.
6. The dataset lists cookie names (not values), storage keys (not values), script URLs and request hosts without query strings. A summary row per domain carries `cookieTable` and `rejectCheck`.
7. A page that finishes all three phases bills `page-scanned` once. A blocked, empty, failed or robots.txt page is free.

One bad page does not fail the run. `RUN_SUMMARY` is written to the key-value store, including when the input is rejected.

Cookie names are matched to a local snapshot of the [Open Cookie Database](https://github.com/jkwakman/Open-Cookie-Database) (Apache License 2.0). The snapshot is shipped with the actor. It is not downloaded during a run.

### Who it is for

- A cookie table for a public site you can open without an account.
- A check of what still loads after a first layer reject.
- A short sample of page types (home, privacy, imprint, one URL per section), not a full crawl.

Sites that only show a banner after login are out of scope.

Guide: [Build a cookie table before and after consent](https://urlwright.com/guides/build-a-cookie-table-before-and-after-consent/).

### Input

The console prefill is one page on `https://urlwright.com/`. If you omit `maxPages`, the default is 10. The hard cap is 50.

```json
{
  "startUrls": ["https://urlwright.com/"],
  "datasetId": "",
  "datasetField": "url",
  "maxPages": 1,
  "waitSecs": 1,
  "timeoutSecs": 45,
  "respectRobotsTxt": true
}
```

`maxPages` is 1 to 50. `waitSecs` is 0 to 15 (default 1) after the banner is ready and after a click. `timeoutSecs` is 10 to 120 (default 45).

`datasetId` plus `datasetField` (default `url`) reads extra targets. If the named field is missing, the actor tries `url`, then `finalUrl`, then `domain`, then `inputUrl`.

`respectRobotsTxt` defaults to true. Set it to false only when you have the right to ignore that file. Crawl-delay is then not applied.

Leave `proxyConfiguration` empty to scan without a proxy. The next section shows how to scan through your own EU proxy.

There is no username, password, cookie or storage state field.

### Scan region

Without a proxy, the scan runs directly from the Apify servers the run is on. Apify runs in the US by default.

A consent banner can look different, or use different defaults, depending on the visitor's country. A CMP such as Usercentrics can show visitors in the US a different banner than visitors in the EU. Results, especially after reject, can differ from what a visitor in the EU sees.

To scan from the EU, set `proxyConfiguration` to your own EU proxy. One session is kept for the whole domain, so `before_consent`, `after_accept` and `after_reject` share that exit.

Your own proxies are the URLs in `proxyUrls`. The run stays on a direct connection until `useApifyProxy` is true or `proxyUrls` lists at least one URL. The host and the credentials in the example are placeholders.

```json
{
  "startUrls": ["https://example.com/"],
  "maxPages": 5,
  "proxyConfiguration": {
    "useApifyProxy": false,
    "proxyUrls": ["http://user:pass@eu-proxy.example:8000"]
  }
}
```

Apify Proxy groups with a country work the same way through `useApifyProxy`, `apifyProxyGroups` and `apifyProxyCountry`, provided your Apify account has IPs in that country.

`scanCountry` on each row is the configured `apifyProxyCountry`, in upper case, when that domain's proxy session is open. It is null when no proxy country was set. It is null when the proxy session is not used. With `proxyUrls`, `scanCountry` stays null because the actor does not know that proxy's country. Without a proxy, `scanCountry` is null and the scan ran from Apify's US servers. `transferBytes` is the response bytes Playwright reported for that phase, including headers. The domain summary and `RUN_SUMMARY` add those phase totals. The actor does not store an IP address. The scan reports what the browser observed from that connection. It is not a legal assessment.

### Output

`schemaVersion` is `1`. Every page phase is its own row (`type: "page"`). Each domain also has one `type: "summary"` row.

A phase row (values omitted on purpose):

```json
{
  "schemaVersion": 1,
  "type": "page",
  "inputUrl": "https://example.com/",
  "domain": "example.com",
  "url": "https://example.com/",
  "finalUrl": "https://example.com/",
  "httpStatus": 200,
  "phase": "before_consent",
  "status": "ok",
  "error": null,
  "cmpDetected": "ExampleCMP",
  "acceptFound": false,
  "rejectFound": false,
  "rejectPath": null,
  "wallMs": 4200,
  "cookies": [],
  "localStorageKeys": [],
  "sessionStorageKeys": [],
  "scriptUrls": [],
  "requestHosts": [],
  "iframes": [],
  "transferBytes": 0,
  "scanCountry": null,
  "charged": false,
  "chargedEvents": { "page-scanned": 0 },
  "fetchedAt": "2026-11-11T12:00:00.000Z"
}
```

`charged` is true on the `before_consent` row only, and only when all three phases finished successfully. The other two phase rows stay free so the page is billed once.

A domain summary:

```json
{
  "schemaVersion": 1,
  "type": "summary",
  "inputUrl": "https://example.com/",
  "domain": "example.com",
  "url": null,
  "status": "ok",
  "pagesScanned": 5,
  "cmpDetected": "ExampleCMP",
  "acceptFoundRate": 1,
  "rejectFoundRate": 1,
  "cookieTable": [
    {
      "schemaVersion": 1,
      "name": "example_id",
      "vendor": "Example",
      "category": "Functional",
      "ocdId": null,
      "matchedBy": "none",
      "cookieDomain": ".example.com",
      "path": "/",
      "type": "cookie",
      "party": "first",
      "expiresDays": 1,
      "duration": "1 day",
      "purpose_en": null,
      "purpose_de": null,
      "firstSeenPhase": "after_accept"
    }
  ],
  "rejectCheck": { "status": "clean", "extraAfterReject": [] },
  "wallMsTotal": 21000,
  "errors": 0,
  "timeouts": 0,
  "transferBytes": 0,
  "scanCountry": null,
  "charged": false,
  "chargedEvents": { "page-scanned": 0 },
  "fetchedAt": "2026-11-11T12:00:00.000Z"
}
```

`rejectCheck.status` is `clean`, `loads-after-reject` or `not-tested`. Extras are counted only when they start after the reject click. A tracker that already started before the click is not an extra.

`transferBytes` is the sum of response body and response header sizes Playwright reported for finished requests in that phase. Bytes it could not report are not included. On a summary row it is the sum of the phase rows. `scanCountry` is the proxy country when a proxy session was used, otherwise null.

`cookieTable` rows use `category` `Functional`, `Preferences`, `Analytics`, `Marketing`, `Security` or `unknown`. `purpose_de` is always null in this version. `matchedBy` is `exact`, `wildcard` or `none`.

Page `status` is `ok`, `empty`, `blocked`, `error`, `timeout`, `ssrf-blocked` or `invalid-input`.

`RUN_SUMMARY` in the key-value store has `chargedEvents`, `byStatus`, `stoppedReason`, `transferBytes` and `scanCountry`. `PPE_LEDGER` remembers pages already pushed so a migrated run does not bill them again.

### Pricing

Pay per event. There is no start fee. The price is the same on every tier.

| Event | When it is billed | Price (every tier) |
|---|---|---:|
| `page-scanned` | One page that finished `before_consent`, `after_accept` and `after_reject` | $0.010 |
| `minimum-fee` | Tops a run that already has at least one paid result up to $0.01 | $0.0001 |

One billed page is already $0.010, so it meets the $0.01 floor and the minimum top-up adds no units at this price.

Not billed: `blocked` (including robots.txt), `empty`, `error`, `timeout`, `ssrf-blocked`, and a run that pushes nothing. A run the user aborts still gets the minimum top up when a page was already billed. A fatal error does not.

Empty runs stay at $0.

### Limitations

- Public pages only. No login, no form fill, no saved cookies.
- Reject is the first banner layer only. A reject that lives behind "settings" is `not-found-first-layer` and is not treated as a failed reject test.
- The cookie database is a snapshot. Unknown names stay `category: "unknown"`.
- `purpose_de` is not filled.
- At most 50 pages per domain. Selection is a sample of templates, not every URL.
- The site owner can change the banner between the three visits. Each phase uses a new browser context.

### FAQ

**Does it store cookie values?**
No. Names, domains, paths, expiry and flags only. Storage output is keys only.

**Why is a page free?**
It was blocked by robots.txt, rejected as a private address, empty, or a phase timed out or failed. Only a page that finishes every phase is billed.

**Which browser is used?**
Headless Chromium. Default memory is 2048 MB.

### No warranty

The scan is a best effort reading of public pages and a banner click. It is not a legal opinion and not a complete cookie audit. Banner markup changes. Always review the result before you rely on it.

# Actor input Schema

## `startUrls` (type: `array`):

Domains or page URLs to scan. Bare domains become https://. Accepts plain strings or Apify request objects with a url field. The homepage of each domain is the start.

## `datasetId` (type: `string`):

Dataset whose rows supply extra domains or URLs (field from datasetField).

## `datasetField` (type: `string`):

Field name on dataset rows. Fallback order when missing: url, finalUrl, domain, inputUrl.

## `maxPages` (type: `integer`):

How many pages to scan on each domain. Default 10. Maximum 50. The homepage, an imprint page and a privacy page are kept when the sitemap lists them. Other pages are one URL per first path segment.

## `waitSecs` (type: `integer`):

Seconds to wait after the consent click (and after the banner is ready). Default 1.

## `timeoutSecs` (type: `integer`):

Timeout for opening a page. Default 45.

## `respectRobotsTxt` (type: `boolean`):

When true (the default), disallowed paths are skipped and Crawl-delay is waited in full. Skipped pages are free.

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

Optional. Leave this empty to scan without a proxy. To open pages from one country, choose Apify Proxy, the RESIDENTIAL group and a country code such as DE. One session is kept per domain so all three phases share that exit region.

## Actor input object example

```json
{
  "startUrls": [
    "https://urlwright.com/"
  ],
  "datasetField": "url",
  "maxPages": 1,
  "waitSecs": 1,
  "timeoutSecs": 45,
  "respectRobotsTxt": true
}
```

# Actor output Schema

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

Dataset rows for each scanned phase.

## `cookieTable` (type: `string`):

One summary row per domain with cookieTable and rejectCheck.

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

Counts, charged events and why the run stopped.

# 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 = {
    "startUrls": [
        "https://urlwright.com/"
    ],
    "maxPages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("urlwright/cookie-consent-scanner").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 = {
    "startUrls": ["https://urlwright.com/"],
    "maxPages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("urlwright/cookie-consent-scanner").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 '{
  "startUrls": [
    "https://urlwright.com/"
  ],
  "maxPages": 1
}' |
apify call urlwright/cookie-consent-scanner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,urlwright/cookie-consent-scanner"
        }
    }
}
```

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/c3aUKefNv0ZFoES9L/builds/6jV0VmkbfrCUJKagO/openapi.json
