# Bing Ads Library Scraper 📢 (`shahidirfan/bing-ads-library-scraper`) Actor

Extract competitor ads from Bing Ads Library instantly. Get ad copy, landing pages, headlines, audiences & bidding strategies. Perfect for ad intelligence, campaign benchmarking, market research & competitive analysis. Fully structured, ETL-ready output.

- **URL**: https://apify.com/shahidirfan/bing-ads-library-scraper.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

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

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Bing Ads Scraper

Extract comprehensive ad intelligence and competitor insights from the Microsoft Ad Library. Collect detailed advertisement data, active dates, advertiser profiles, and performance metrics at scale. Perfect for marketing research, competitive analysis, and ad copy optimization.

---

### Features

- **Competitor Intelligence** — Monitor competitor ad campaigns, active runtimes, and targeting structures.
- **Automated Pagination** — Crawl multiple result pages seamlessly to gather all relevant listings.
- **Structured Export** — Save collected data in developer-friendly and business-ready formats.
- **Robust Evasion** — Avoid rate limits and access restrictions using advanced routing systems.

---

### Use Cases

#### Competitive Analysis
Track which competitors are actively running ads on specific keywords. Analyze their copywriting strategies, unique selling points, and landing page destinations.

#### Trend Monitoring
Discover emerging marketing trends in real-time. Understand how advertisers adjust their promotions and messaging based on seasonal events or consumer demands.

#### Ad Copy Optimization
Gather thousands of high-converting headlines and descriptions to inspire your own creative writing and improve click-through rates.

---

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `query` | String | No | — | Search query to find specific ads |
| `advertiserId` | String | No | — | Target a specific advertiser by their ID |
| `resultsWanted` | Integer | No | `20` | Maximum number of ads to extract |
| `maxPages` | Integer | No | `1` | Maximum number of result pages to crawl |
| `proxyConfiguration` | Object | No | `{"useApifyProxy": true}` | Settings to route requests reliably |

> [!NOTE]
> **Runtime Input Priority:** User-provided parameters at runtime (via the Apify Console UI or API calls) always override default/prefill values configured in the schema.

---

### Output Data

Each item in the dataset contains:

| Field | Type | Description |
|-------|------|-------------|
| `adId` | String | Unique identification number for the ad |
| `advertiserId` | String | Unique ID identifying the advertiser account |
| `advertiserName` | String | Registered name of the advertiser |
| `adTitle` | String | Headline text of the advertisement |
| `adDescription` | String | Body copy and description text of the ad |
| `adImpressions` | String | Range showing estimated ad impressions |
| `adDestination` | String | Final destination URL of the ad link |
| `adStartDate` | String | Commencement date of the ad campaign |
| `adEndDate` | String | Concluding date of the ad campaign |
| `advertiserPaidForBy` | String | Disclosed payer or sponsor of the ad |
| `impressionsByCountry` | Array | Estimated country-level impression split |
| `targets` | Array | Targeted parameters and demographic criteria |

---

### Usage Examples

#### Search by Keyword

Extract active ads targeting a specific term:

```json
{
  "query": "workspace software",
  "resultsWanted": 20,
  "maxPages": 2
}
````

#### Track Specific Advertiser

Gather all current promotions running for a known business entity:

```json
{
  "advertiserId": "4294982386",
  "resultsWanted": 50,
  "maxPages": 3
}
```

#### Combined Target Search

Narrow down results by combining advertiser tracking with keyword filters:

```json
{
  "query": "discount",
  "advertiserId": "4294982386",
  "resultsWanted": 10,
  "maxPages": 1
}
```

***

### Sample Output

```json
{
  "adId": 72568100319632,
  "adTitle": "Apify® - Apify.com - Official Website",
  "adDescription": "Build Reliable Web Scrapers in Minutes with Apify's User-Friendly Interface.",
  "adDestination": "https://apify.com/",
  "advertiserId": 4294982386,
  "advertiserName": "Retainup Inc",
  "advertiserPaidForBy": "Retainup Inc",
  "adStartDate": "2023-09-13",
  "adEndDate": "2023-10-01",
  "adImpressions": "<1K",
  "impressionsByCountry": [
    {
      "country": "Germany",
      "impressionShare": 49.5
    },
    {
      "country": "Croatia",
      "impressionShare": 14.7
    }
  ],
  "targets": [
    {
      "targetType": "Location",
      "usedForExclusion": false
    }
  ]
}
```

***

### Tips for Best Results

#### Start with Small Batches

Always run tests with `resultsWanted` set to `10` or `20` to ensure your search queries or advertiser IDs return the expected results before initiating larger runs.

#### Use High-Quality Proxies

Use residential proxy settings when running high-volume extractions to maintain high success rates and bypass IP rate limits.

#### Verify Advertiser IDs

Double-check advertiser IDs by visiting the Microsoft Ad Library directly to ensure you are querying the correct numeric identifier.

***

### Integrations

Connect your data with:

- **Google Sheets** — Export data directly for spreadsheet analysis.
- **Airtable** — Build dynamic, collaborative databases.
- **Slack** — Set up automated notifications for new competitor ads.
- **Zapier** — Automate multi-step business workflows.

#### Export Formats

- **JSON** — Structured format for developers and API consumption.
- **CSV** — Tabular format for Excel and business reporting.
- **XML** — Standard format for legacy system integrations.

***

### Frequently Asked Questions

#### Can I scrape multiple pages of ads?

Yes. Adjust the `maxPages` and `resultsWanted` input parameters to control how deep the scraper goes.

#### How do I locate the advertiser ID?

The advertiser ID is a unique number visible in the URL when viewing an advertiser's profile in the Microsoft Ad Library.

#### What proxy setup is recommended?

We recommend using residential proxies to bypass rate limiting and ensure stable extraction.

#### Is the scraped data real-time?

Yes, the scraper pulls active campaigns directly from the live Microsoft Ad Library.

#### Can I filter ads by country?

The scraper returns ads for countries targeted by the queried advertiser campaigns.

***

### Support

For issues or feature requests, contact support through the Apify Console.

#### Resources

- [Apify Documentation](https://docs.apify.com/)
- [API Reference](https://docs.apify.com/api/v2)

***

### Legal Notice

This actor is designed for legitimate data collection purposes. Users are responsible for ensuring compliance with website terms of service and applicable laws.

# Actor input Schema

## `query` (type: `string`):

You can search for ads containing words in a specific order or ads containing words in any order. Use quotation marks if you're searching for ads containing words in a specific order. For example, "red shoe sale" will bring up search results for all ads that contain "red shoe sale." Don't use quotation marks if you're searching for ads containing multiple words in any order.

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

The advertiser ID is a unique number that identifies the advertiser's account on Microsoft Ad Library

## `resultsWanted` (type: `integer`):

Maximum number of ads to extract.

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

Maximum number of pages to crawl.

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

Select proxies to use for the crawler.

## Actor input object example

```json
{
  "query": "services",
  "resultsWanted": 20,
  "maxPages": 1,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "query": "services",
    "resultsWanted": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/bing-ads-library-scraper").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 = {
    "query": "services",
    "resultsWanted": 20,
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "services",
  "resultsWanted": 20
}' |
apify call shahidirfan/bing-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=shahidirfan/bing-ads-library-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Bing Ads Library Scraper 📢",
        "description": "Extract competitor ads from Bing Ads Library instantly. Get ad copy, landing pages, headlines, audiences & bidding strategies. Perfect for ad intelligence, campaign benchmarking, market research & competitive analysis. Fully structured, ETL-ready output.",
        "version": "0.0",
        "x-build-id": "uvI2FVKOYXjXg52AT"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/shahidirfan~bing-ads-library-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-shahidirfan-bing-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/shahidirfan~bing-ads-library-scraper/runs": {
            "post": {
                "operationId": "runs-sync-shahidirfan-bing-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/shahidirfan~bing-ads-library-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-shahidirfan-bing-ads-library-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "You can search for ads containing words in a specific order or ads containing words in any order. Use quotation marks if you're searching for ads containing words in a specific order. For example, \"red shoe sale\" will bring up search results for all ads that contain \"red shoe sale.\" Don't use quotation marks if you're searching for ads containing multiple words in any order."
                    },
                    "advertiserId": {
                        "title": "Advertiser ID",
                        "type": "string",
                        "description": "The advertiser ID is a unique number that identifies the advertiser's account on Microsoft Ad Library"
                    },
                    "resultsWanted": {
                        "title": "Results Wanted",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of ads to extract.",
                        "default": 20
                    },
                    "maxPages": {
                        "title": "Max Pages",
                        "type": "integer",
                        "description": "Maximum number of pages to crawl.",
                        "default": 1
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Select proxies to use for the crawler.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
