LinkedIn Ad Library Scraper API: Research B2B Advertising
LinkedIn's Ad Library reveals B2B advertising strategies. This guide shows you how to research competitor LinkedIn campaigns.
LinkedIn Ad Library Endpoints
| Endpoint | Description |
|---|---|
| Search | Search ads by company or keyword |
| Ad Details | Get detailed ad information |
Search LinkedIn Ads
Find ads from a company:
const response = await fetch('https://api.sociavault.com/linkedin-ad-library/search', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
company: 'Microsoft'
})
});
const ads = await response.json();
Response
{
"company": {
"name": "Microsoft",
"linkedInUrl": "https://www.linkedin.com/company/microsoft",
"followers": 22000000
},
"ads": [
{
"id": "urn:li:sponsoredContent:123456789",
"headline": "Transform your business with AI",
"description": "Discover how Microsoft AI can help your organization...",
"callToAction": "Learn More",
"startDate": "2026-01-01",
"endDate": null,
"status": "ACTIVE",
"format": "single_image",
"mediaUrl": "https://...",
"targetUrl": "https://microsoft.com/ai",
"impressions": "100K-500K",
"targeting": {
"locations": ["United States", "Canada"],
"industries": ["Technology", "Finance"],
"jobFunctions": ["IT", "Marketing"],
"seniorityLevels": ["Director", "VP", "C-Suite"]
}
}
],
"hasMore": true
}
Ad Details
Get comprehensive information about a specific ad:
const response = await fetch('https://api.sociavault.com/linkedin-ad-library/ad-details', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.linkedin.com/ad-library/...'
})
});
const adDetails = await response.json();
Use Cases
B2B Competitor Analysis
Analyze competitor B2B advertising:
async function analyzeB2BCompetitor(company) {
const { ads } = await searchLinkedInAds(company);
return {
totalActiveAds: ads.filter(a => a.status === 'ACTIVE').length,
formats: countFormats(ads),
callToActions: countCTAs(ads),
avgImpressions: analyzeImpressions(ads),
targetingPatterns: analyzeTargeting(ads)
};
}
function countCTAs(ads) {
const ctas = {};
ads.forEach(ad => {
ctas[ad.callToAction] = (ctas[ad.callToAction] || 0) + 1;
});
return ctas;
}
function analyzeTargeting(ads) {
const targeting = {
industries: {},
jobFunctions: {},
seniority: {}
};
ads.forEach(ad => {
ad.targeting.industries?.forEach(i => {
targeting.industries[i] = (targeting.industries[i] || 0) + 1;
});
ad.targeting.jobFunctions?.forEach(j => {
targeting.jobFunctions[j] = (targeting.jobFunctions[j] || 0) + 1;
});
ad.targeting.seniorityLevels?.forEach(s => {
targeting.seniority[s] = (targeting.seniority[s] || 0) + 1;
});
});
return targeting;
}
Targeting Research
Study how competitors target audiences:
async function studyTargeting(competitors) {
const targetingData = {};
for (const company of competitors) {
const { ads } = await searchLinkedInAds(company);
// Aggregate targeting
const allIndustries = ads.flatMap(a => a.targeting.industries || []);
const allFunctions = ads.flatMap(a => a.targeting.jobFunctions || []);
const allSeniority = ads.flatMap(a => a.targeting.seniorityLevels || []);
targetingData[company] = {
topIndustries: getTop5(allIndustries),
topJobFunctions: getTop5(allFunctions),
topSeniority: getTop5(allSeniority)
};
}
return targetingData;
}
function getTop5(arr) {
const counts = {};
arr.forEach(item => counts[item] = (counts[item] || 0) + 1);
return Object.entries(counts)
.sort((a, b) => b[1] - a[1])
.slice(0, 5)
.map(([item]) => item);
}
Messaging Analysis
Study B2B ad messaging:
async function analyzeMessaging(company) {
const { ads } = await searchLinkedInAds(company);
const headlines = ads.map(ad => ad.headline);
// Analyze patterns
const patterns = {
questions: headlines.filter(h => h.includes('?')).length,
numbers: headlines.filter(h => /\d/.test(h)).length,
actionWords: headlines.filter(h =>
/transform|discover|unlock|accelerate|boost/i.test(h)
).length
};
// Extract common words
const words = headlines.join(' ').toLowerCase().split(/\s+/);
const wordCounts = {};
words.forEach(w => {
if (w.length > 4) wordCounts[w] = (wordCounts[w] || 0) + 1;
});
return {
patterns,
topWords: Object.entries(wordCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 10)
};
}
Creative Format Analysis
See what ad formats competitors use:
async function analyzeFormats(company) {
const { ads } = await searchLinkedInAds(company);
const formats = {};
ads.forEach(ad => {
formats[ad.format] = (formats[ad.format] || 0) + 1;
});
return {
totalAds: ads.length,
formats,
mostCommon: Object.entries(formats)
.sort((a, b) => b[1] - a[1])[0][0]
};
}
Campaign Timeline
Track competitor campaign activity:
async function trackCampaigns(company) {
const { ads } = await searchLinkedInAds(company);
// Group by start month
const byMonth = {};
ads.forEach(ad => {
const month = ad.startDate.substring(0, 7);
byMonth[month] = (byMonth[month] || 0) + 1;
});
// Find active vs inactive
const active = ads.filter(a => a.status === 'ACTIVE');
const inactive = ads.filter(a => a.status !== 'ACTIVE');
return {
campaignsByMonth: byMonth,
activeAds: active.length,
inactiveAds: inactive.length,
avgCampaignLength: calculateAvgLength(ads)
};
}
Cross-Platform Analysis
Compare LinkedIn ads with other platforms:
async function fullB2BAudit(company) {
const [linkedInAds, googleAds, facebookAds] = await Promise.all([
searchLinkedInAds(company),
getGoogleAds(company),
getFacebookAds(company)
]);
return {
linkedin: {
total: linkedInAds.ads.length,
targeting: analyzeTargeting(linkedInAds.ads),
b2bFocus: true
},
google: {
total: googleAds.ads.length,
formats: countFormats(googleAds.ads)
},
facebook: {
total: facebookAds.ads.length,
platforms: countPlatforms(facebookAds.ads)
},
recommendation: linkedInAds.ads.length > 0
? 'Active on LinkedIn - B2B focused'
: 'Not active on LinkedIn - consider B2B opportunities'
};
}
Related Endpoints
- Facebook Ad Library - Meta ads
- Google Ad Library - Google ads
- LinkedIn Scraper - LinkedIn profiles
Frequently Asked Questions
What types of ads are in the LinkedIn Ad Library?
Sponsored Content, Message Ads, and other LinkedIn ad formats from verified advertisers.
Can I see exact targeting criteria?
The Ad Library shows general targeting parameters like industries, job functions, and seniority levels.
How current is the data?
LinkedIn's Ad Library updates regularly. Active campaigns appear within days of launching.
Are all LinkedIn advertisers included?
Advertisers meeting LinkedIn's transparency requirements are included. Political ads have additional disclosures.
Can I see ad performance metrics?
Impression ranges are shown (e.g., "100K-500K"), but exact metrics aren't publicly available.
Get Started
Sign up free and start researching LinkedIn B2B ads.
Documentation: /docs/api-reference/linkedin-ad-library/search
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.