# Google Consent Mode v2 Checker - gcs/gcd Before & After Consent (`that_red_bird/consent-mode-v2-checker`) Actor

Is Google Consent Mode v2 really working? Loads each page, records GA4 and Google Ads hits before consent and after Accept and Reject, decodes gcs/gcd into plain words and flags tags firing early or ignoring a reject. Bulk, takes a Maps dataset's website column.

- **URL**: https://apify.com/that_red_bird/consent-mode-v2-checker.md
- **Developed by:** [mohamed alaya](https://apify.com/that_red_bird) (community)
- **Categories:** Developer tools, Lead generation, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 page auditeds

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 Consent Mode v2 Checker - gcs/gcd Before & After Consent

Checks whether Google Consent Mode v2 really works on a website: it records the Google Analytics (GA4), Google Ads and Tag Manager requests a page sends before consent, after clicking Accept and (in a fresh browser) after clicking Reject, and decodes the `gcs` / `gcd` consent parameters of every hit.
For EU agencies, CMP resellers and GA4 consultants who need to test many sites, both consent paths, without clicking through each one by hand.

### Input examples

```json
{ "urls": ["https://www.example.com/"] }
```

Bulk from a Google Maps scraper dataset:

```json
{ "datasetId": "YOUR_MAPS_DATASET_ID", "websiteField": "website", "maxUrls": 50 }
```

EU view with a German proxy (consent banners often show only to EU visitors):

```json
{ "urls": ["https://www.example.de/"], "proxyConfiguration": { "useApifyProxy": true, "apifyProxyCountryCode": "DE" } }
```

### Input guide

| Field | Meaning |
|---|---|
| `urls`, `datasetId`, `websiteField` | Sites to test; dataset website column optional |
| `settleSeconds` | Recording window before the banner is clicked |
| `afterClickSeconds` | Recording window after Accept / Reject |
| `maxUrls`, `concurrency`, `locale`, `proxyConfiguration` | Size, speed, language, proxy |

### Output

Two row types (views `sites` and `hits`):

**`type: "site"`**: `verdict` (`PASS`, `WARN`, `FAIL`, `NO_HITS_SEEN`, `NO_GOOGLE_TAGS`), `findings[]` (code, severity, message), `consentPlatformDetected`, `googleTagIds`, `gtmContainers`, `v2SignalsSeen`, and per phase (`beforeConsent`, `afterAccept`, `afterReject`): hit counts by state (`denied`, `granted`, `unset`, `noSignal`), whether the button was clicked and how.

**`type: "hit"`** (free detail, up to 40 per site): `phase`, `kind` (ga4, ads-conversion, ads-ccm, ads-remarketing), `event`, `tid`, `state`, `gcs`, `ad_storage`, `analytics_storage`, `gcd`, `ad_user_data`, `ad_personalization`.

Decoding: `gcs=G1xy` = ad_storage x and analytics_storage y (1 granted, 0 denied, - not set). `gcd` is parsed into ad_storage, analytics_storage, ad_user_data and ad_personalization; the state letters `r` (granted), `q` (denied) and `l` (not set) are decoded, any other letter is returned as `unknown` with the raw code.

Sample hit row:

```json
{ "type": "hit", "pageUrl": "https://www.hubspot.com/", "phase": "after-accept", "kind": "ga4", "state": "granted",
  "gcs": "G111", "gcd": "13r3r3r2r5l1", "ad_storage": "granted", "analytics_storage": "granted" }
```

### Findings you can get

`GRANTED_BEFORE_CONSENT`, `NO_CONSENT_SIGNAL_BEFORE_CONSENT`, `GRANTED_AFTER_REJECT`, `NO_SIGNAL_AFTER_REJECT`, `NOT_GRANTED_AFTER_ACCEPT`, `NO_GCD_V2_SIGNALS`, `GRANTED_NO_BANNER_SEEN`, `REJECT_NOT_CLICKED` (no first-layer reject button found), and informational ones.

### Use it with

Google Maps scraper -> this Actor for agency prospecting; `gdpr-risky-embeds-checker` and `gpc-opt-out-checker` for the full EU + US consent pack.

### FAQ

**Why FAIL with "no banner seen"?** A US datacenter visit often gets no EU banner and a granted default. That is reported as a warning (`GRANTED_NO_BANNER_SEEN`); repeat with an EU proxy.

**Which hits count?** GA4 `/g/collect`, Ads conversion / user-list / ccm and remarketing requests, plus Tag Manager and gtag script loads.

### Honest limits

Banners are clicked by CMP selectors and button text (English, German, French, Spanish, Italian, Dutch, Portuguese, Danish, Swedish). Banners that need a second layer or an unusual widget may not be clicked (`clicked: false`). Rejecting usually needs a first-layer button. One anonymous visit per path; server-side tagging is seen only if it uses the usual `/g/collect` path. Only 3 gcd state letters are decoded. Public pages only. Not legal advice.

### Price

**$0.005 per site audited** (`page-audited`). Errors and hit rows are free. Example: 40 sites = $0.20.

# Actor input Schema

## `urls` (type: `array`):

Public pages to test, one per line. For each page the Actor records Google Analytics, Google Ads and Tag Manager requests before consent, after clicking Accept and (in a fresh browser) after clicking Reject.

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

Pick the dataset of a Google Maps scraper run. The website column of every place is added to the URLs above, so you can test a whole list of local businesses. Social-media links are skipped.

## `websiteField` (type: `string`):

Name of the field in the dataset that holds the website address. Google Maps scrapers use 'website'. Only used when a dataset is selected.

## `maxUrls` (type: `integer`):

Upper limit on how many sites are tested in one run (URLs plus dataset rows). Each site needs two browser visits, roughly 40 to 60 seconds in total.

## `concurrency` (type: `integer`):

How many sites are tested at the same time. Keep it low; each one uses full browser contexts.

## `settleSeconds` (type: `integer`):

Seconds to keep recording after the page has loaded and before the banner is clicked. This is the 'before consent' window.

## `afterClickSeconds` (type: `integer`):

Seconds to keep recording after clicking Accept or Reject, so the consent update and any follow-up hits are seen.

## `locale` (type: `string`):

Language the browser announces (Accept-Language), for example en-US or de-DE.

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

Optional Apify proxy. Many consent banners only appear for visitors from Europe; pick an Apify proxy with a European country code to see the EU banner. Off by default: the Actor visits sites directly from an Apify datacenter IP.

## Actor input object example

```json
{
  "urls": [
    "https://www.w3schools.com/",
    "https://example.com/"
  ],
  "websiteField": "website",
  "maxUrls": 30,
  "concurrency": 2,
  "settleSeconds": 4,
  "afterClickSeconds": 5,
  "locale": "en-US",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `sites` (type: `string`):

No description

## `hits` (type: `string`):

No description

## `downloadCsv` (type: `string`):

No description

## `summary` (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 = {
    "urls": [
        "https://www.w3schools.com/",
        "https://example.com/"
    ],
    "websiteField": "website",
    "locale": "en-US",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("that_red_bird/consent-mode-v2-checker").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 = {
    "urls": [
        "https://www.w3schools.com/",
        "https://example.com/",
    ],
    "websiteField": "website",
    "locale": "en-US",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("that_red_bird/consent-mode-v2-checker").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 '{
  "urls": [
    "https://www.w3schools.com/",
    "https://example.com/"
  ],
  "websiteField": "website",
  "locale": "en-US",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call that_red_bird/consent-mode-v2-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,that_red_bird/consent-mode-v2-checker"
        }
    }
}
```

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/9PSCEEOzU528Ap9nM/builds/8hMBdna2TlVcGR3U7/openapi.json
