How to Scrape Google Ad Results
Google is the most popular search engine and they made money via Ads. Google included Google Ad Results in their search results page. The Google Ad results can be shopping ads, local services ads, text ads.
Many companies run their Ads on Google Platform to drive more clicks and generate more leads and sales. Scraping Google Ad Results is super useful for businesses; you can conduct research for certain keywords, analyze competitors' ads, pricing, and promotional strategies, and identify valuable keywords that competitors are bidding on.
Google Ad Results provides valuable data to make good decisions in marketing, advertising, competitive strategy. SerpApi provides a high-quality Google Ad Results API, so you can scrape your thousand ad results without any worry about being blocked by Google.
Setting Up a SerpApi Account
SerpApi offers a free plan for newly created accounts. Head to the sign-up page to register an account and complete your first search with our interactive playground. When you want to do more searches with us, please visit the pricing page.
Once you are familiar with all the results, you can utilize SERP APIs using your API Key.
Scrape your first Google Ad result with SerpApi
Head to the Google Ad API from the documentation on SerpApi for details.
Let's find the top hotels in Paris. The data contains: "position", "title", "thumbnail", "price", "rating", "reviews", "source", and more. You can also scrape more information with SerpApi.
First, you need to install the SerpApi client library.
pip install google-search-results
Set up the SerpApi credentials and search.
from serpapi import GoogleSearch
import os, json, csv
params = {
'api_key': 'YOUR_API_KEY', # your serpapi api
'engine': 'google', # SerpApi search engine
'q': 'Hotel in Paris'
}
To retrieve Google Ad Results for a query, you can use the following code:
results = GoogleSearch(params).get_dict()['ads']
You can store Google Ad Results JSON data in databases or export them to a CSV file.
import csv
header = ["position", "title", "thumbnail", "price", "rating", "reviews", "source"]
with open("google_ad_results.csv", "w", encoding="UTF8", newline="") as f:
writer = csv.writer(f)
writer.writerow(header)
for item in results:
writer.writerow([item.get('position'), item.get('title'), item.get('thumbnail'), item.get('price'), item.get('rating'), item.get('reviews'), item.get('source')])
This example uses Python, but you can also use all your favorite programming languages like Ruby, NodeJS, Java, PHP, and more.
If you have any questions, please feel free to contact me.