In the ever-evolving landscape of digital acquisition, staying ahead of the curve means understanding the nuances of user intent.
As SEO and performance marketing professionals, we constantly seek to uncover the hidden gems that drive traffic and conversions.
Two powerful tools in our arsenal, often overlooked, are Google’s “Related Searches” and “People Also Ask” (PAA) features.
These seemingly simple elements hold a wealth of information that can significantly impact your content strategy and advertising campaigns.
Disclaimer: The following post details the implementation of a Python script designed to automate the acquisition of search engine data. It is assumed that readers possess a basic working knowledge of Python, including the ability to execute scripts within their development environment. For individuals requiring supplementary Python training, Google’s comprehensive Python course is a valuable resource: https://developers.google.com/edu/python.
Why “Related Searches” and “People Also Ask” Matter
Deeper Understanding of User Intent:
- “Related Searches” provide a glimpse into the broader context of a user’s query, revealing alternative phrasing, tangential topics, and common follow-up searches.
- “People Also Ask” questions expose the specific inquiries users have surrounding a topic, highlighting pain points and information gaps.
Enhanced Content Strategy:
- By analyzing these features, you can identify long-tail keywords and content opportunities that align with user intent.
- PAA questions can serve as a blueprint for creating comprehensive, user-centric content that addresses specific concerns.
Optimized Performance Marketing:
- Related searches can inform keyword targeting for PPC campaigns, ensuring your ads reach the right audience.
- Understanding PAA can help craft ad copy that directly answers user questions, increasing click-through rates and conversions.
Competitive Advantage:
- Many marketers neglect these valuable resources, giving you an edge in uncovering untapped opportunities.
The Challenge: Automating Data Extraction
While manually reviewing “Related Searches” and PAA for a few queries is feasible, scaling this process for a large keyword set is incredibly time-consuming.
This is where automation becomes essential. However, automating the extraction of this data presents several challenges:
- Dynamic HTML Structure: Google’s search results page is constantly evolving, making it difficult to rely on static HTML selectors.
- Anti-Scraping Measures: Google employs sophisticated anti-scraping techniques to prevent automated data extraction.
- Rate Limiting: Excessive requests can lead to IP blocking or CAPTCHAs.
- Data Parsing: Extracting relevant information from the raw HTML requires robust parsing logic.
My Solution: A Python Script Leveraging SerpAPI for Automated Data Extraction
Recognizing the immense value of this data and the challenges of manual extraction, I developed a Python script that leverages SerpAPI, a powerful Google Search API, to automate the process of fetching ‘Related Searches’ and ‘People Also Ask’ (PAA).
This approach offers a reliable and efficient way to extract this valuable information.
Here’s how it works:
1. SerpAPI Integration:
- The script utilizes the SerpAPI Python library to send structured requests to Google’s search engine.
- By providing a set of search queries, the API returns the search results in a JSON format, which is easily parsed.
2. Data Extraction:
- The script parses the JSON response to extract the ‘Related Searches’ and ‘People Also Ask’ sections.
- This structured data allows for easy storage and analysis.
3. Scalability and Efficiency:
- SerpAPI handles the complexities of interacting with Google’s search engine, including parsing dynamic HTML and managing anti-scraping measures.
- This allows the script to efficiently process a large number of search queries.
4. Implementation Details:
- You will need to create a free SerpAPI account and obtain an API key.
- The Script uses a list variable “search_queries” where you can add all the keywords that you want to analyze.
- SerpAPI provides a free quota, but usage is limited. For extensive data extraction, a paid plan may be necessary.
- It is important to understand that using SerpAPI is a legal and allowed method, different from direct web scraping of google search results.
Here is the code:
import json
import time
import pandas as pd
from serpapi import GoogleSearch
# Replace with your own SerpAPI key
SERPAPI_KEY = "place_your_key_here"
def get_related_searches(query):
"""Fetch related searches and 'users also searched' from Google SERP."""
params = {
"q": query,
"hl": "el", # Change to English if needed
"gl": "gr", # Change to English if needed
"api_key": SERPAPI_KEY
}
search = GoogleSearch(params)
results = search.get_dict()
print(json.dumps(results, indent=4)) # Debugging: Print full JSON response
related_searches = results.get("related_searches", [])
related_queries = [rs.get("query") for rs in related_searches]
# Extract 'People also search for' (if available)
people_also_search = results.get("organic_results", [])
also_searched_queries = []
for res in people_also_search:
if "people_also_search_for" in res:
also_searched_queries.extend(res["people_also_search_for"])
return {
"query": query,
"related_searches": related_queries,
"people_also_searched": also_searched_queries
}
def main():
search_queries = [
"basketball shoes",
"running shoes",
]
all_results = []
for query in search_queries:
print(f"Fetching results for: {query}")
result = get_related_searches(query)
all_results.append(result)
time.sleep(2) # To prevent hitting API limits too fast
# Save to JSON
with open("related_searches.json", "w", encoding="utf-8") as f:
json.dump(all_results, f, indent=4, ensure_ascii=False)
# Save to CSV with UTF-8 encoding
df = pd.DataFrame(all_results)
df.to_csv("related_searches.csv", index=False, encoding="utf-8-sig")
print("Results saved successfully with UTF-8 encoding!")
if __name__ == "__main__":
main()
Steps:
1. Install the required library:
pip install google-search-results
2. Get a free API key from SerpAPI.
3. Run the above script.
Output:
- The script will save: related_searches.json (JSON file with structured results) and related_searches.csv (CSV file for easy analysis).
Notes:
- You can modify the search_queries list to include any terms you want.
- SerpAPI has a free quota but limits requests per month. If you exceed the limit, you’ll need to upgrade or use a different API.
- If you want a completely free method, you’d need to use Selenium or BeautifulSoup with Google’s search page, but scraping Google directly is against its TOS.
Practical Applications: How to Leverage the Extracted Data
Now that you have access to a wealth of “Related Searches” and PAA data, how can you put it to practical use? Here are some actionable strategies:
Content Creation:
- Identify recurring questions in PAA and create dedicated blog posts or FAQ sections to address them.
- Use “Related Searches” to discover related topics and expand your content coverage.
- Optimize existing content with long-tail keywords found in “Related Searches” and PAA.
SEO Optimization:
- Incorporate relevant keywords from “Related Searches” and PAA into your meta descriptions and title tags.
- Build internal links to related content based on the connections revealed by “Related Searches.”
- Create a FAQ schema markup using the PAA data.
Performance Marketing:
- Expand your keyword lists for PPC campaigns with relevant terms from “Related Searches.”
- Use PAA questions to craft compelling ad copy that directly addresses user concerns.
- Create landing pages that answer specific PAA questions to improve conversion rates.
Topic Clustering:
- Use the related searches to create topic clusters, and create pillar pages.
- Create a content calendar based on topic clusters.
Competitor Analysis:
- Analyze the related searches and PAA for your competitors keywords, and identify content gaps.
- Find new long tail keywords that your competitors are not targeting.
Conclusion
“Related Searches” and “People Also Ask” are invaluable resources for digital acquisition professionals.
By automating the extraction of this data, we can unlock deeper insights into user intent and gain a competitive edge.
My custom script provides a powerful tool for this purpose.
I encourage you to explore these features and incorporate them into your content and marketing strategies.
Download the script and start exploring the potential of “Related Searches” and PAA today!
Feel free to leave a comment or get in touch me with on LinkedIn with your questions or insights.