# 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:** 3 total users, 3 monthly users, 89.3% 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/actors/running/actors-in-store.md#pay-per-usage

## 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

## 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.
- **Reliable Collection** — Pace requests, retry temporary network failures, and stop cleanly on access errors.

***

### Use Cases

#### Competitive Analysis

Track ads from advertisers whose names match your search. To filter ads by text, combine `query` with a specific `advertiserId`.

#### Trend Monitoring

Discover recent marketing trends. Understand how advertisers adjust promotions and messaging for 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 advertiser names, then collect their ads; with `advertiserId`, filter that advertiser's ads by text |
| `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 |

The actor uses Microsoft's public Ad Library API anonymously. No Microsoft account or token input is required. It spaces requests and automatically increases its delay when Microsoft returns HTTP 429. Public API access and rate limits are controlled by Microsoft, so a 403 means the service denied the request and cannot be repaired by changing proxy settings alone. See [Microsoft's Ad Library API guide](https://learn.microsoft.com/en-us/advertising/guides/ad-library-api?view=bingads-13).

***

### 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 Advertiser Name

Find advertisers whose names match the query and collect their ads:

```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

Start with `resultsWanted` set to `10` or `20` to confirm your search query or advertiser ID returns data before increasing the limit.

#### Use Stable Proxy Settings

The default Apify Proxy setting can help with network reliability. The actor uses the public endpoint without Microsoft credentials; proxy settings do not change Microsoft's API access 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?

The default Apify Proxy setting is enabled for network reliability. Microsoft's public API limits still apply. If the API responds with HTTP 429, the actor slows subsequent requests and retries a limited number of times.

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

The scraper returns the current information published by Microsoft Ad Library. Microsoft notes that an ad's reported end date can lag recent activity by one to three days.

#### 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`):

Search advertiser names and collect their ads. When used with advertiserId, this also filters that advertiser's ads by text.

## `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(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 '{
  "query": "services",
  "resultsWanted": 20
}' |
apify call shahidirfan/bing-ads-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,shahidirfan/bing-ads-library-scraper"
        }
    }
}
```

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/ODtvYyuPk8kTPN562/builds/91EPNmMsFxaY5Lhtm/openapi.json
