« SERP API Data Scraper

SERP API Google Ads Library Scraper

Download Data to Excel & CSV Files

Steve Spagnola
Written by Steve Spagnola
Last updated May 8, 2024

Scraping the Google Ads Library

If you want to scrape or analyze your competitors’ Google Ads, check out the Google Ads Transparency Center, or “Google Ads Library” where you can enter in any advertiser or search term to see the advertisements they’ve been running.

Google Ads Containing "Tesla"

This can be very useful if you’re performing trademark enforcement, and looking for encroaching websites that are using your brand name or products in their advertising.

Additionally, this can be useful for e-commerce businesses to see the exact images and video creatives that competitors are using.

All 2024 Tesla US Image Ads

In order to scrape this data, we’ll walk through using the Unofficial SerpApi Google Ads Library API to run searches for ad keywords or advertisers and receive back structured data containing links to the ad creatives as images.

1. Get a Serp API Key

To use SerpApi, you’ll need to sign up for a free SerpAPI account and you’ll get 100 free searches per month (10,000 ad creatives at 100 results per search) to test the service out. Once you have an account, go to your SerpAPI API Key and copy the value so you can use it with our service:

Serp API Key

2. Run Queries

Using the green box on this page, you can run an initial search on the Google Ads Library. We suggest starting with the domain name (or keyword) of a competitor or a keyword that describes the types of goods. You can really just enter anything in and see what happens, we’ll refine the results in the next step.

Run a Search Query

3. Review & Refine

In the above example, we entered in tesla.com to see what showed up. We end up seeing a lot of different advertisers running ads to different domains as shown below.

Results for Tesla.com

If we were looking for trademark infringement, then this is perfect as we now have a potential list of domains that are profiting off of the Tesla name. However, lets say we’re a competitor to Tesla and want to scrape all the ads that Tesla’s running in 2024 in image format within the U.S. We can scroll down and review these advanced options that SerpApi provides:

Refine Query to Advertiser ID

Here, we removed the “Query” parameter and instead provided the “Advertiser ID” we saw in the results for the official “Tesla, Inc.” result. We also added additional filters that SerpApi provides us.

4. Download Data

We can then execute the endpoint again with the added filters, and we’ll now only see the image ads that Tesla has been running in the provided timeframe (2024).

All Image Ads for Tesla

The important columns to note in the output are as follows:

  • Advertiser ID (Can refine by in the future if needed)
  • Advertiser Name
  • Ad Format
  • Target Domain
  • Image URL (This does not appear to work for video ads unfortunately)
  • Width & Height
  • First Ran Timestamp
  • Last Seen Timestamp

Note the link column that SerpApi does not appear to be working at the time of this article, and instead links to a JavaScript file used in the Google Ads Library interface. We hope that SerpApi fixes this soon, but in the mean time the only way to actually see the ads in the scraped data is through the image column, which will render an image for text & image based ads.

Pagination

SerpApi offers a next_page_token parameter you can use to retrieve the next page of results, so you can download all of the possible ad creatives. You’ll need to look for the next_page_token field in the first response from the API and then feed that in as an input to your next request in the next_page_token parameter to get the next page of results.

You can manually do this using your own code, or consider using our SERP API Google Ads Library - Pagination Workflow to automatically query the API and manage the pagination parameter passing for you, combining the results into a single CSV file for all of the ad creatives.