DEV Community

mamangwarkop
mamangwarkop

Posted on Originally published at mamangwarkop.github.io

How to Bulk Check Google Ads Spend & Verify B2B Leads using Python and n8n (Zero-Budget Guide)

How to Bulk Check Google Ads Spend & Verify B2B Leads using Python and n8n

If you run outbound sales, marketing consultancy, or lead generation workflows, you know that pitching paid media services to a business that doesn't run ads (or pitching organic SEO to someone with a \$50k/month paid ads budget) ruins your conversion rates.

The key to hyper-targeted cold outreach is prospect qualification via advertising transparency data.

In this guide, we'll break down:

  1. Why Google Ads Transparency Center is a goldmine for B2B intelligence.
  2. How to extract active ad counts and verified advertiser credentials programmatically.
  3. How to automate the entire lead enrichment pipeline using n8n and Python.

1. The Challenge with Manual Ad Research

Google launched the Ads Transparency Center to provide public visibility into all active ad creatives across Search, YouTube, and Display.

However, agencies face two major bottlenecks:

  • No Native Bulk Export: The official UI only supports looking up one single advertiser domain at a time.
  • Enterprise Software Costs: Tools like Semrush or SpyFu charge \$150 to \$300/month for ad intelligence subscriptions.

By directly querying the underlying gRPC/JSON endpoints, you can evaluate 1,000+ prospect domains in under 2 minutes.


2. The Core Architecture

Here is the data pipeline:

[ Domain List / CSV / CRM ]
          │
          ▼
[ Google Ads Transparency Scraper ]
          │
          ├──> Resolves Verified Advertiser Name & Country
          ├──> Counts Active Search, YouTube & Display Creatives
          └──> Computes adSpendTier (Enterprise / Growth / Testing / None)
          │
          ▼
[ n8n Automation Engine ]
          │
          ├──> Enriches with Emails & WhatsApp (wa.me)
          └──> Generates Personalized Cold Pitch Hook
Enter fullscreen mode Exit fullscreen mode

Categorization Rules for High-Conversion Outbound:

Ad Count adSpendTier Outreach Angle / Pitch Hook
50+ Ads Enterprise Creative fatigue testing, video ad scaling, landing page CRO.
10 - 49 Ads Growth Multi-channel retargeting (Meta/TikTok pixel parity).
1 - 9 Ads Testing Ad copy optimization, negative keyword audits.
0 Ads None Competitor conquesting, high-intent Google Search setup.

3. Implementing with Python

Here is a lightweight Python snippet demonstrating how to query Google Ads Transparency:

import urllib.request
import json

def check_domain_ads(domain: str):
    url = "https://adstransparency.google.com/anji/_/rpc/SearchService/SearchSuggestions"
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
        "Content-Type": "application/x-www-form-urlencoded"
    }
    # Form data request with domain query
    payload = f"f.req=%5B%22{domain}%22%2Cnull%2Cnull%2Cnull%5D"
    req = urllib.request.Request(url, data=payload.encode("utf-8"), headers=headers, method="POST")

    with urllib.request.urlopen(req, timeout=10) as resp:
        content = resp.read().decode("utf-8")
        # Google prefixes RPC responses with ')]}\' to prevent JSON hijacking
        clean_json = content.split('\n', 1)[-1]
        data = json.loads(clean_json)
        return data

# Example usage
# res = check_domain_ads("shopify.com")
# print(res)
Enter fullscreen mode Exit fullscreen mode

4. Plug-and-Play Cloud Solution & Free n8n Template

If you don't want to maintain proxies, headless browsers, or session cookies on your own infrastructure, we've packaged the complete production-grade pipeline:

  1. Production Cloud Actor on Apify Store:

    • Run in the cloud or integrate via REST API: Google Ads Transparency Scraper on Apify
    • Handles automatic retry, pagination, and multi-country geographic targeting.
    • Apify provides \$5 free monthly credits, which is more than enough to test 5,000+ domain lookups.
  2. Open-Source GitHub Repository:

  3. Free n8n Workflow Blueprint:


Conclusion & Next Steps

Targeting leads based on verified ad spend transforms outbound response rates from the standard 1-2% up to 8-12%. Prospects appreciate outreach that references their actual live campaigns and creative choices rather than generic cookie-cutter templates.

Feel free to clone the repository or fork the actor. Happy automating!

Top comments (0)