# LinkedIn Ad Library Scraper: Ads with Targeting (`tacps126/linkedin-ad-library-scraper`) Actor

Scrape the LinkedIn Ad Library: B2B ads by company, website or keyword, with text, headline, image or video, call to action, landing page, dates, impressions, share per country and the targeting used (job, company, location).

- **URL**: https://apify.com/tacps126/linkedin-ad-library-scraper.md
- **Developed by:** [Tapaswai Choudhary](https://apify.com/tacps126) (community)
- **Categories:** Marketing, Lead generation, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.46 / 1,000 linkedin ads

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: Ads with Targeting

Get the ads a company runs on LinkedIn from the LinkedIn Ad Library, or every ad that mentions a keyword. Ad
text, headline, image or video, call to action, landing page, who paid, dates, impressions, the share of
impressions per country and the targeting used: language, location, company, job, audiences. No LinkedIn
account needed.

### At a glance

- **Find ads your way:** company name as LinkedIn shows it, website domain, LinkedIn company page link, a
  search link copied from the Ad Library, or keywords in ad text.
- **Ad creative:** text, headline, image or video cover, call to action, landing page, and the text of
  message ads. Thought-leader ads name the person whose post it is and their title.
- **Reach and targeting:** impressions range, share of impressions per country, and each targeting option
  with whether the advertiser used it and the values LinkedIn names. LinkedIn publishes these for ads shown in
  the EU.
- **Who is behind the ad:** company name, ID, page, logo, and who paid.
- **Filters:** country, running now or all, date range (LinkedIn keeps the last year), ad type.
- **Monitoring:** turn on *Only new ads* and schedule the run to get each new ad once.
- **Price, each part below the usual Store price:** $0.50 per 1,000 ads, plus $1.30 per 1,000 for the ad's
  page with dates, impressions, countries and targeting (on by default, charged only when LinkedIn publishes
  them for the ad). A small start fee per run; lower prices on higher Apify plans.

### Input

```json
{
  "advertisers": ["hubspot.com", "https://www.linkedin.com/company/salesforce/"],
  "keywords": ["sales automation"],
  "country": "ALL",
  "activeStatus": "all",
  "dateFrom": "3 months",
  "maxAdsPerAdvertiser": 100
}
```

### Output

One row per ad.

```json
{
  "source": "linkedin",
  "query": "hubspot.com",
  "advertiserName": "HubSpot",
  "advertiserId": "68529",
  "advertiserUrl": "https://www.linkedin.com/company/68529",
  "adId": "1643384704",
  "adUrl": "https://www.linkedin.com/ad-library/detail/1643384704",
  "format": "image",
  "firstShown": "2026-11-12",
  "lastShown": "2026-11-14",
  "isActive": true,
  "headline": "Answers grounded in your HubSpot data.",
  "text": "Connect HubSpot to ChatGPT and get answers grounded in your real contacts, deals, and tickets.",
  "callToAction": "Learn more",
  "landingUrl": "https://www.hubspot.com/chatgpt",
  "paidForBy": "HubSpot, Inc.",
  "impressions": "10k-20k",
  "regions": ["GB", "IE"],
  "regionStats": [
    { "region": "GB", "impressionShare": 86 },
    { "region": "IE", "impressionShare": 14 }
  ],
  "targeting": [
    { "parameter": "Language", "targeted": true, "includes": "English" },
    { "parameter": "Location", "targeted": true, "includes": "Ireland, United Kingdom" },
    { "parameter": "Company", "targeted": true, "excluded": false },
    { "parameter": "Job", "targeted": true, "excluded": false },
    { "parameter": "Audience", "targeted": false, "excluded": true }
  ]
}
```

### Questions

**Why do some ads have no dates, impressions or targeting?** LinkedIn publishes those for ads shown in the EU.
Other ads show the creative, the company and who paid, and are not charged the extra.

**Why did a company name find nothing?** The name must match the company name on LinkedIn. Try the website
domain, the company page link, or a search link copied from the Ad Library.

**Need Google, Meta or TikTok ads too?** Competitor Ads (tacps126/competitor-ads) reads all four libraries in
one run, in the same row shape.

# Actor input Schema

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

Companies to read, one per line: a company name as LinkedIn shows it (HubSpot), a website domain (hubspot.com), a LinkedIn company page link, or a search link copied from the LinkedIn Ad Library.

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

Words to find in ad text, from any company (crm, sales automation).

## `country` (type: `string`):

Where the ads ran: a two-letter country code (US, GB, DE, IN...) or ALL for every country.

## `activeStatus` (type: `string`):

Running now, or every ad in the library.

## `dateFrom` (type: `string`):

Only ads shown on or after this date (2026-10-01) or within a period (30 days, 2 weeks, 3 months).

## `dateTo` (type: `string`):

Only ads shown on or before this date (2026-11-14).

## `mediaType` (type: `string`):

Only ads of this kind. Text means text-only ads (no image or video).

## `linkedinAdDetails` (type: `boolean`):

Open each LinkedIn ad for its full text, call to action, landing page, the advertiser's page, who paid, the dates it ran, total impressions, the share of impressions per country and the audience it targeted. Charged per ad (see Pricing). Off: the ad as the search shows it (advertiser, format, text cut after a few lines, headline, image).

## `maxAdsPerAdvertiser` (type: `integer`):

Most ads to return for each advertiser or keyword, in each library.

## `maxItems` (type: `integer`):

Most ads per run, both libraries together.

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

Schedule the Actor and each run returns only ads that earlier runs did not deliver, tracked per advertiser: adding a brand later does not reset the others.

## `monitorName` (type: `string`):

Optional name for the "only new" history, so several monitors can run side by side.

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

Apify proxy on by default. Leave it as is unless you want to use your own proxy.

## `tenantId` (type: `string`):

Optional label used to keep separate histories for different clients or teams.

## `debug` (type: `boolean`):

Verbose logs.

## `delivery` (type: `object`):

Webhook: {"webhookUrl": "https://...", "format": "json" | "slack" | "discord", "onlyWhenResults": true, "includeItems": 10}. Google Sheets: {"spreadsheetId": "<id from the sheet URL>", "sheetName": "Sheet1"} plus the service account key below; share the sheet with the service account's e-mail first. Leave empty to only save results in the dataset.

## `googleServiceAccountJson` (type: `string`):

Only for Google Sheets delivery: paste the service account's JSON key. Stored encrypted; the account sees only sheets you share with it.

## Actor input object example

```json
{
  "advertisers": [
    "hubspot.com"
  ],
  "country": "ALL",
  "activeStatus": "active",
  "mediaType": "all",
  "linkedinAdDetails": true,
  "maxAdsPerAdvertiser": 10,
  "maxItems": 200,
  "onlyNew": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "debug": false
}
```

# Actor output Schema

## `results` (type: `string`):

One row per ad; the source field says which library it came from.

## `summary` (type: `string`):

Counts per library, warnings, and whether the run stopped early.

# 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.com"
    ],
    "country": "ALL",
    "maxAdsPerAdvertiser": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("tacps126/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.com"],
    "country": "ALL",
    "maxAdsPerAdvertiser": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("tacps126/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.com"
  ],
  "country": "ALL",
  "maxAdsPerAdvertiser": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call tacps126/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tacps126/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/u5eHXL5VVsSALZNqg/builds/74hf6QfEpreSAg1GH/openapi.json
