# LinkedIn Ad Library Scraper: Ads, Targeting, Impressions (`apt_squirrel/linkedin-ad-library-scraper`) Actor

See what any company advertises on LinkedIn. Search the public LinkedIn Ad Library by advertiser or keyword and get every ad with its text, link, format, run dates, who paid for it, impressions by country and targeting. No LinkedIn account or cookies.

- **URL**: https://apify.com/apt_squirrel/linkedin-ad-library-scraper.md
- **Developed by:** [YDidkivskiy](https://apify.com/apt_squirrel) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## LinkedIn Ad Library Scraper

See what any company is advertising on LinkedIn, and to whom.

Search LinkedIn's public Ad Library by **advertiser** or by **keyword** and get every ad as a clean row: text, headline, landing page, format, run dates, who paid, impressions by country and the targeting the advertiser chose. No LinkedIn account, no cookies, nothing that can get a profile banned.

### What you get that other scrapers do not

- **Video files** (MP4 at every quality) and poster, **every carousel image**, the **advertiser logo** and the **call-to-action label**.
- **Impressions as numbers** (`impressionsMin`, `impressionsMax`) next to LinkedIn's range text.
- **Days running and whether the ad is still active.**

### What it is for

- **Competitor research**: which messages, offers and landing pages a competitor is paying to promote right now.
- **Agencies**: build a swipe file of ads in a client's niche in minutes.
- **Sales**: a company that is advertising is a company that is spending; use the ad's landing page as the opener.
- **Market monitoring**: run a keyword daily and catch new advertisers entering your space.

### Output

| Field | What it holds |
|---|---|
| `adId`, `adUrl` | the ad in the Ad Library |
| `advertiserName`, `advertiserUrl` | who runs it |
| `creativeType` | format code, for example `SPONSORED_STATUS_UPDATE`, `SPONSORED_VIDEO`, `TEXT_AD` |
| `text`, `headline` | the ad copy, untruncated when details are on |
| `imageUrl` | the main image |
| `destinationUrls` | landing pages, with LinkedIn's tracking parameter removed |
| `paidBy` | the paying entity |
| `ranText`, `startDate`, `endDate` | when the ad ran |
| `totalImpressions` | LinkedIn's range, for example `1k-5k` |
| `impressionsByCountry` | country and share of impressions |
| `targeting`, `targetingCategories` | language, location and which targeting groups were included or excluded |
| `detailsFetched` | `false` when the ad's own page could not be opened and only the basics are present |

LinkedIn does not publish impressions and targeting for every ad (it does so mainly for ads shown in the EU), so those fields are empty for many ads. That is how the Ad Library works, not a gap in this actor.

### Input

```json
{
  "advertisers": ["HubSpot", "Salesforce"],
  "keywords": ["crm software"],
  "countries": ["US", "GB"],
  "dateOption": "last-30-days",
  "maxAdsPerSearch": 100,
  "scrapeAdDetails": true
}
```

Each advertiser and each keyword is a separate search. The advertiser search matches names the way the Ad Library's own search box does, so a broad name can return ads from similarly named advertisers; check `advertiserName` in the results.

### Reliability

LinkedIn refuses requests from data-centre addresses, so the actor uses residential proxies and switches to a new address on every retry. If LinkedIn still refuses an ad's detail page, you get the ad with its basic fields and `detailsFetched: false` rather than losing it. The run's status message tells you how many requests were refused and retried.

### Monitoring: get only what is new

Turn on **Only new results** and schedule the actor (Schedules in Apify Console, for example every morning). Each run remembers what earlier runs of the same input returned and saves only the ads that appeared since. You pay only for new rows; the first run returns everything.

- Runs with the same input share one memory. Give a **Monitor name** to keep several independent watch lists.
- Connect the run to Slack, email, Google Sheets or a webhook through Apify integrations and the new ads arrive as alerts.

### Use it from code, no-code tools and AI agents

- **API**: start a run and get the results in one HTTP call, or use the Apify Python and JavaScript clients. Results download as JSON, CSV, Excel or XML.
- **Integrations**: Make, Zapier, n8n, Google Sheets, Slack and webhooks, from the run's Integrations tab.
- **AI agents**: the actor is available as a tool through the Apify MCP server, so AI assistants and agents can call it directly.

### Pricing

Pay per result: one result is one ad. Proxy traffic is included in the price. Users on paid Apify plans get an automatic discount of up to 33%.

# Actor input Schema

## `advertisers` (type: `array`):

Company or person names, as you would type them into the Ad Library search box.

## `keywords` (type: `array`):

Find ads by words in their text, from any advertiser.

## `countries` (type: `array`):

Optional. Two-letter country codes (US, GB, DE). Only ads shown in these countries.

## `dateOption` (type: `string`):

Only ads that ran in this period.

## `maxAdsPerSearch` (type: `integer`):

Stop each advertiser or keyword search after this many ads.

## `scrapeAdDetails` (type: `boolean`):

Adds run dates, payer, impressions by country, targeting and the full text. Turn off for a faster run with the basics only.

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

LinkedIn blocks data-centre addresses, so residential proxies are required.

## `onlyNew` (type: `boolean`):

Return only results that earlier runs of this same search have not returned yet. Turn it on for scheduled runs: you get, and pay for, only what is new since the last run. The first run returns everything.

## `monitorId` (type: `string`):

Optional. Runs with the same name share one memory of what was already returned. Leave empty to use one memory per distinct input.

## Actor input object example

```json
{
  "advertisers": [
    "HubSpot"
  ],
  "dateOption": "",
  "maxAdsPerSearch": 24,
  "scrapeAdDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "onlyNew": false
}
```

# Actor output Schema

## `results` (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 = {
    "advertisers": [
        "HubSpot"
    ],
    "maxAdsPerSearch": 24,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("apt_squirrel/linkedin-ad-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 = {
    "advertisers": ["HubSpot"],
    "maxAdsPerSearch": 24,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("apt_squirrel/linkedin-ad-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 '{
  "advertisers": [
    "HubSpot"
  ],
  "maxAdsPerSearch": 24,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call apt_squirrel/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apt_squirrel/linkedin-ad-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/rUB2OnQjku16XtIM1/builds/mLcXmnkn7bE84hsMG/openapi.json
