Skip to content
intermediate

How to Use ProxyScrape Residential Proxies for SEO Rank Tracking

Build a small Python rank tracker that pulls SERPs through ProxyScrape's rotating residential pool, with retries, throttling, geo-targeting notes, and per-request exit IP logging.

Web Scraping SEO Monitoring

Overview

Search engines return different results depending on the IP that asks. SEO rank tracking therefore needs requests that look like ordinary users from the right location, which is what a rotating residential pool provides. ProxyScrape's residential pool (97M+ IPs) hands out a new exit IP per request or holds a sticky session, and its datacenter proxies are a cheaper option for high-volume endpoints that do not block hosting ranges.

This tutorial builds a minimal Python rank tracker that reads SERPs through ProxyScrape. Only scrape pages you are permitted to access, and respect the target site's terms of service and robots directives.

Steps

  1. Collect credentials and ports. In the ProxyScrape dashboard, note the residential gateway host, its HTTP and SOCKS5 ports, and your username/password. Rotating endpoints usually issue a new IP per request; if a sticky-session option exists on your plan, the dashboard shows the syntax for it.

  2. Install the dependencies.

    python -m venv .venv && source .venv/bin/activate
    pip install requests beautifulsoup4
    # add PySocks only if you intend to use the SOCKS5 port:
    pip install "requests[socks]"
    
  3. Store credentials as environment variables so they never reach your source control:

    export PS_HOST="your-host"
    export PS_PORT="your-http-port"
    export PS_USER="your-username"
    export PS_PASS="your-password"
    
  4. Build a proxy dictionary. For the HTTP port:

    import os
    proxy_url = f"http://{os.environ['PS_USER']}:{os.environ['PS_PASS']}@{os.environ['PS_HOST']}:{os.environ['PS_PORT']}"
    proxies = {"http": proxy_url, "https": proxy_url}
    

    For the SOCKS5 port, use the socks5h:// scheme so DNS is resolved at the proxy:

    proxy_url = f"socks5h://{os.environ['PS_USER']}:{os.environ['PS_PASS']}@{os.environ['PS_HOST']}:{os.environ['PS_SOCKS_PORT']}"
    
  5. Add geo-targeting if your plan supports it. Some residential plans let you pin a country or city by appending a code to the username. The exact syntax differs per plan, so use the format shown in your ProxyScrape dashboard rather than guessing.

  6. Fetch a SERP with retries. Rotate the IP, wait between requests, and back off on failures:

    import random, time, requests
    
    HEADERS = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36",
        "Accept-Language": "en-US,en;q=0.9",
    }
    
    def fetch_serp(keyword, num=20, attempts=3):
        for attempt in range(attempts):
            try:
                r = requests.get(
                    "https://www.google.com/search",
                    params={"q": keyword, "num": num, "hl": "en"},
                    headers=HEADERS, proxies=proxies, timeout=20,
                )
                if r.status_code == 200:
                    return r.text
            except requests.RequestException:
                pass
            time.sleep(2 ** attempt + random.random())
        return None
    
  7. Throttle and rotate deliberately. Keep concurrency low (2–5 workers), add a 2–10 second random delay between queries, and use a fresh request per keyword so each SERP comes from a different IP. HTTP 429 or 503 responses mean you are going too fast — slow down instead of retrying immediately.

  8. Parse and store the result.

    from bs4 import BeautifulSoup
    html = fetch_serp("proxy comparison")
    soup = BeautifulSoup(html, "html.parser")
    for i, a in enumerate(soup.select("a[href^=http]"), start=1):
        print(i, a.get_text(" ", strip=True)[:80], a["href"])
    

    Result markup changes over time, so verify your selectors against the live DOM before relying on them. Write each run's rows (keyword, position, URL, timestamp, exit IP) to a CSV file or database.

  9. Log the exit IP for every request so you can tell a genuine ranking change from a location change:

    curl -x "http://USER:PASS@HOST:PORT" https://ipinfo.io/json