# Google Ads Transparency API (`experthasan/google-ads-transparency-api`) Actor

Powerful Google Ads Transparency Center scraper or google ad library API. Search ads by domain or advertiser ID. Features automatic pagination, format filtering (Image, Video, Text), regional support, and detailed creative metadata extraction. perfect for competitive intelligence and ad research.

- **URL**: https://apify.com/experthasan/google-ads-transparency-api.md
- **Developed by:** [Mahmudul Hasan](https://apify.com/experthasan) (community)
- **Categories:** SEO tools, Lead generation, Developer tools
- **Features:** Limited permissions
- **Stats:** 135 total users, 12 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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 Ads Transparency API Scraper

> **The most robust and reliable way to scrape Google Ads Transparency Center data.**
> Effortlessly search for ads by domain, advertiser, or keyword and extract creative details including images, videos, and text.

[![Apify](https://img.shields.io/badge/Apify-Actor-714EFF?style=flat-square\&logo=apify)](https://apify.com/store) [![FastAPI](https://img.shields.io/badge/FastAPI-009688?style=flat-square\&logo=fastapi\&logoColor=white)](https://fastapi.tiangolo.com) [![Python](https://img.shields.io/badge/Python-3.12-3776AB?style=flat-square\&logo=python\&logoColor=white)](https://python.org)

***

### ✨ Features

- **🔍 Comprehensive Search**: Search ads by **Domain** (e.g., `google.com`) or **Advertiser ID**.
- **🌍 Global Coverage**: Support for searching ads in specific countries (e.g., US, CA, UK).
- **🎞️ Multiple Formats**: Filter by **Image**, **Video**, or **Text** usage.
- **📄 Pagination**: Automatically handles pagination to retrieve up to thousands of ads.
- **⚡ Super Fast**: Built with FastAPI and optimized for speed and high concurrency.
- **🛡️ Resilience**: Intelligent retry logic and caching to handle rate limits and ensure success.

***

### 🚀 Usage

#### Input Parameters

| Parameter | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `searchType` | String | `"domain"` | **Required**. One of: `"domain"`, `"advertiser_id"`, `"creative_details"`. |
| `domain` | String | - | Required if `searchType` is `"domain"`. The domain to search ads for (e.g., `nike.com`). |
| `advertiserId` | String | - | Required if `searchType` is `"advertiser_id"` or `"creative_details"`. |
| `creativeId` | String | - | Required if `searchType` is `"creative_details"`. |
| `countryCode` | String | `"US"` | Two-letter country code (e.g., `US`, `GB`, `CA`, `DE`). |
| `format` | String | `"ALL"` | Filter ad format: `"ALL"`, `"IMAGE"`, `"VIDEO"`, `"TEXT"`. |
| `limit` | Integer | `40` | Number of results per page (Max 40 per request, handled automatically by actor paginator). |
| `maxPages` | Integer | `1` | Maximum number of pages to scrape. Each page contains up to 40 ads. |
| `startPeriod` | String | - | Start date (`YYYY-MM-DD`). Only for `advertiser_id` search. |
| `endPeriod` | String | - | End date (`YYYY-MM-DD`). Only for `advertiser_id` search. |

#### Example Input

##### 1. Search by Domain (Most Common)

Scrape the first 120 image ads for `nike.com` in the US.

```json
{
    "searchType": "domain",
    "domain": "nike.com",
    "countryCode": "US",
    "format": "IMAGE",
    "limit": 40,
    "maxPages": 3
}
```

##### 2. Search by Advertiser ID

Filter ads by a specific time range.

```json
{
    "searchType": "advertiser_id",
    "advertiserId": "AR1234567890",
    "startPeriod": "2024-01-01",
    "endPeriod": "2024-02-01",
    "maxPages": 5
}
```

##### 3. Get Creative Details

Fetch detailed metadata for a specific ad creative.

```json
{
    "searchType": "creative_details",
    "advertiserId": "AR1234567890",
    "creativeId": "CR0987654321"
}
```

***

### 📦 Output Structure

The actor stores results in the default Apify Dataset. Each item usually represents one ad creative.

```json
{
    "advertiser_id": "AR15743419998638669825",
    "advertiser_name": "Google LLC",
    "creative_id": "CR11090006764426559489",
    "original_url": "https://adstransparency.google.com/advertiser/AR15743419998638669825/creative/CR11090006764426559489?region=US",
    "variants": [
        {
            "content": "<div...>...</div>",
            "image": "https://tpc.googlesyndication.com/simgad/...",
            "format": "Image"
        }
    ],
    "start": "2024-03-15",
    "last_seen": "2024-03-20",
    "format_type": "Image"
}
```

***

### 🧑‍💻 programmatic Usage (Python Client)

You can easily run this actor using the Apify Python Client.

```bash
pip install apify-client
```

```python
from apify_client import ApifyClient

## Initialize the client with your API token
client = ApifyClient("YOUR_APIFY_TOKEN")

## Prepare the Actor input
run_input = {
    "searchType": "domain",
    "domain": "airbnb.com",
    "countryCode": "US",
    "maxPages": 2,
}

## Run the Actor and wait for it to finish
run = client.actor("your-username/google-ads-scraper").call(run_input=run_input)

## Fetch and print Actor results from the run's dataset (if the run was successful)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### 🔗 Resources

- **Google Ads Transparency Center**: <https://adstransparency.google.com/>
- **Apify SDK**: <https://docs.apify.com/sdk/python>
- **FastAPI**: <https://fastapi.tiangolo.com/>

# Actor input Schema

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

Type of search to perform

## `domain` (type: `string`):

Domain to search for ads (e.g., google.com). Required when searchType is 'domain'

## `advertiserId` (type: `string`):

Advertiser ID (e.g., AR123...). Required when searchType is 'advertiser_id' or 'creative_details'

## `creativeId` (type: `string`):

Creative ID. Required when searchType is 'creative_details'

## `countryCode` (type: `string`):

Country code for regional filtering

## `format` (type: `string`):

Filter by ad format

## `limit` (type: `integer`):

Maximum number of ads to retrieve per page (max 40)

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

Maximum number of pages to scrape (for pagination)

## `startPeriod` (type: `string`):

Start date filter (YYYY-MM-DD). Only for advertiser_id search

## `endPeriod` (type: `string`):

End date filter (YYYY-MM-DD). Only for advertiser_id search

## Actor input object example

```json
{
  "searchType": "domain",
  "domain": "google.com",
  "advertiserId": "AR123456789",
  "creativeId": "CR123456789",
  "countryCode": "US",
  "format": "ALL",
  "limit": 40,
  "maxPages": 1,
  "startPeriod": "2024-01-01",
  "endPeriod": "2024-12-31"
}
```

# 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 = {
    "searchType": "domain",
    "domain": "google.com",
    "countryCode": "US",
    "format": "ALL",
    "limit": 40,
    "maxPages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("experthasan/google-ads-transparency-api").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 = {
    "searchType": "domain",
    "domain": "google.com",
    "countryCode": "US",
    "format": "ALL",
    "limit": 40,
    "maxPages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("experthasan/google-ads-transparency-api").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 '{
  "searchType": "domain",
  "domain": "google.com",
  "countryCode": "US",
  "format": "ALL",
  "limit": 40,
  "maxPages": 1
}' |
apify call experthasan/google-ads-transparency-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,experthasan/google-ads-transparency-api"
        }
    }
}
```

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/722kzPPKrTlV2tcjv/builds/BC1hgI3NBkbe1aOYq/openapi.json
