We use Google Analytics and PostHog to see which pages bring in customers and where visitors get stuck. Until you agree both run without cookies — they count the pages you open and what you click, but cannot recognise you across visits. Agreeing lets them use cookies, so we can tell repeat visitors apart, lets PostHog record a replay of your visit, with anything you type hidden, and loads OpenAI’s measurement pixel, which shows us whether a visit came from one of our ads in ChatGPT. Nothing is sent to OpenAI until you agree. Either way we never build advertising profiles or target ads. Privacy Policy

15% off your first purchase with code WELCOME15, up to 25 GB.

See pricing

Guide · Scraping practice

How to build your own rank tracker in Python

A working rank tracker is five small parts: a keyword list with a market per row, one proxy session per check that exits in that market, a headless browser that loads the results page, a parser that turns the page into ordered organic results, and a table that stores every check with a status. The browser is not optional for Google: since January 2025 its results page requires JavaScript. The code on this page is about 100 lines of Python. We ran it on 2026-11-02 against a local fixture page through a local authenticated proxy, not against Google, and the parser is kept in one function because that is the part you will rewrite when the markup changes.

Reviewed 2 Nov 2026

The short answer

  • Pipeline: keywords → geo-targeted proxy session → headless Chromium → parse_organic() → SQLite. Only the parser knows anything about the page's markup.
  • Google requires JavaScript for Search since January 2025, so an HTTP client alone no longer gets a results page. Budget for a browser per check.
  • Use one sticky session per check (_session-<id>_sesstime-5), so the page and its subresources leave from one exit, and a new session for the next check.
  • Store a status for every check: ok, consent, captcha or an error. A blocked check must never be recorded as "not ranking".
  • Google's terms forbid automated access that ignores its robots.txt, which disallows /search. For your own site, the Search Console API reports average position by query, country and device without scraping.

The design in five parts

PartWhat it doesWhat breaks it
Keyword listRows of keyword, country, optional city, interface languageMixing markets: "Canada in French" and "Canada in English" are two rows
Proxy sessionA username that pins country, city and one sticky exit for this checkReusing one session for many checks; a city not on the supported list
Headless browserLoads the results page and runs its JavaScriptConsent interstitials, CAPTCHAs, timeouts
ParserTurns the rendered page into (position, URL, title) rows, organic onlyMarkup changes; ads or feature blocks counted as organic
StorageOne row per check, one row per result, with a timestamp and statusTreating a failed check as a ranking of "none"

Each part can be swapped without touching the others. That is the point: the proxy layer is configuration, the browser is a library, and the parser is the only code that knows what the page looks like.

Why a browser and not requests

On 17 January 2025 TechCrunch reported that Google had begun requiring JavaScript to use Search; a Google spokesperson said that enabling JavaScript lets it better protect its services from bots and abuse. A plain HTTP fetch of the results page no longer returns results, which is why this tracker uses Playwright with Chromium. A rendered page transfers far more bytes than an HTML fetch, so block images, fonts and media in the browser; rank tracking bandwidth has the arithmetic.

Depth costs pages. In September 2025 Search Engine Journal reported that Google appeared to have stopped honouring the &num=100 parameter, so a tool that wants the top 100 needs up to ten result pages instead of one. Google had not issued a statement. Track the top 10 daily and go deeper less often unless you need it.

One proxy session per check

Targeting lives in the proxy username. The tracker composes it per check from the market row and a fresh session handle, so the results page and every request it triggers leave from the same exit, and the next check gets a different one. Five minutes is plenty for one page load.

TokenExampleWhat it does
_pool-_pool-arcfastThe pool: arc (rotating ISP), arcfast or arcultra (residential)
_country-_country-usExit country, lowercase ISO 3166-1 alpha-2
_city-_city-newyorkCity, lowercased with spaces removed; 38 metros in 12 countries are supported
_session-_session-84796027Any handle; the same handle returns the same exit while it lasts
_sesstime-_sesstime-5Minutes to hold the exit, best effort upstream

Run your first check through the proxy location checker with the same username to see where the exit actually geolocates. City targeting is metro-level, which is what local rank tracking can honestly offer; for country matrices see international rank tracking.

Parsing: the part that will break

  • Keep every selector in one function. In the code below ORGANIC matches our lab fixture, not Google. Google's markup is not a documented interface and changes without notice, so inspect a saved results page and write the selector for today's markup.
  • Read the rendered DOM, not the HTML you received. Our first version ran a regular expression over page.content() and found nothing, because Chromium re-serialises attributes with double quotes. Querying the DOM avoided that class of bug.
  • Exclude sponsored results and feature blocks explicitly. The lab fixture has a sponsored result above the organic list; the parser skips it because it is not inside the organic container.
  • Save the raw page whenever the parser returns zero results on an ok status. That is how you notice a markup change on day one instead of a week of false "dropped out" reports.
  • Test the parser against saved pages, offline, before every deploy.

Storing results so a failure is never a ranking

  • checks: run time, keyword, country, city, status, your position (or empty), number of results parsed.
  • results: run time, keyword, country, position, URL, title. The full top 10, so you can see who replaced you.
  • An empty position with status ok means "not in the results we parsed". An empty position with status consent, captcha or error:* means "not measured". Reports must show the second as a gap, not a drop.
  • Use UTC timestamps. Markets in different time zones are still one run.

What we ran, and what we did not

Run on 2026-11-02 with Python 3.12.6, Playwright 1.54.0 and Chromium 139 (headless) against a local fixture: a small http.server that returns a results page whose order depends on gl, reached through a local forward proxy that required Basic authentication and logged the username it received. The three markets in the code each produced ten organic rows and a position for example.com; the sponsored row was skipped; a fourth fixture query that returns a consent page was stored with status consent and no position.

The lab proxy parsed the usernames exactly as the grammar intends, for example pool=arcfast, country=us, city=newyork, session=84796027, sesstime=5, with a new session handle per check. Playwright's per-context proxy option answered the proxy's 407 challenge without extra code.

We did not run the tracker against Google. A single headless load of a live Google results page from our test machine, a German residential line, was answered with Google's CAPTCHA page at /sorry/, which is the outcome your status column has to expect.

Terms of service and the official alternatives

Google's Terms of Service (effective 30 July 2026) list "using automated means to access content from any of our services in violation of the machine-readable instructions on our web pages" as abuse, with robots.txt as the example. On 2026-11-02, www.google.com/robots.txt disallowed /search for all user agents. A proxy changes where a request comes from; it does not change those terms, solve CAPTCHAs or render JavaScript for you.

If you only need your own site's rankings, use Google's data instead of scraping. The Search Console API's searchanalytics.query returns average position grouped by query, page, country and device. The Custom Search JSON API is closed to new customers and is being discontinued on 1 January 2027, so it is not a path for a new tool.

Scraping results pages makes sense when you need competitors' positions, markets or result features that your own Search Console data cannot show. Weigh that against the terms above, and keep volume and pacing modest.

Code

Worked example

rank_tracker.py: run on 2026-11-02 against a local fixture, not Google
"""Minimal rank tracker: keywords -> geo-targeted proxy -> headless browser -> parse -> SQLite.pip install playwright && playwright install chromium"""import os, secrets, sqlite3, timefrom datetime import datetime, timezonefrom urllib.parse import urlencode, urlparsefrom playwright.sync_api import sync_playwrightPROXY_SERVER = os.environ.get("PROXY_SERVER", "http://proxy.arcproxies.io:8000")PROXY_USER = os.environ.get("PROXY_USER", "USERNAME")      # subuser from the dashboardPROXY_PASS = os.environ.get("PROXY_PASS", "PASSWORD")SEARCH_URL = os.environ.get("SEARCH_URL", "https://www.google.com/search")MY_DOMAIN = "example.com"KEYWORDS = [  # keyword, country, city (None = country only), interface language    ("proxy rotation", "us", "New York", "en"),    ("proxy rotation", "gb", "Manchester", "en"),    ("proxy rotation", "de", None, "de"),]def proxy_username(country: str, city: str | None, session: str, minutes: int = 5) -> str:    """{user}_pool-{pool}_country-{cc}[_city-{city}]_session-{id}_sesstime-{min}"""    user = f"{PROXY_USER}_pool-arcfast_country-{country.lower()}"    if city:        user += "_city-" + "".join(city.lower().split())    # "New York" -> newyork    return user + f"_session-{session}_sesstime-{minutes}"ORGANIC = "div.result a:has(h3)"   # lab fixture markup, NOT Google'sdef parse_organic(page) -> list[tuple[int, str, str]]:    """The ONLY markup-specific function. ORGANIC matches the lab fixture, not    Google: Google's markup is undocumented and changes without notice, so    expect to rewrite this, and test it on saved pages. Reads the rendered DOM."""    rows = page.eval_on_selector_all(        ORGANIC, "els => els.map(a => [a.href, a.querySelector('h3').innerText])")    return [(i + 1, url, title) for i, (url, title) in enumerate(rows)]def detect_wall(url: str, html: str) -> str | None:    if "/sorry/" in url or "unusual traffic" in html.lower():        return "captcha"    if "consent." in url or "Before you continue" in html:        return "consent"    return Nonedef check(browser, keyword: str, country: str, city: str | None, hl: str) -> dict:    session = secrets.token_hex(4)          # one exit IP for this whole page load    ctx = browser.new_context(locale=hl, proxy={        "server": PROXY_SERVER, "username": proxy_username(country, city, session), "password": PROXY_PASS})    page = ctx.new_page()    page.route("**/*", lambda r: r.abort() if r.request.resource_type in {"image", "font", "media"} else r.continue_())    url = f"{SEARCH_URL}?{urlencode({'q': keyword, 'hl': hl, 'gl': country})}"    try:        page.goto(url, wait_until="domcontentloaded", timeout=30_000)        wall = detect_wall(page.url, page.content())        return {"status": wall or "ok", "results": [] if wall else parse_organic(page)}    except Exception as e:                  # timeouts, proxy errors: a status, never a rank        return {"status": f"error:{type(e).__name__}", "results": []}    finally:        ctx.close()def store(db, run_at: str, kw, country, city, outcome: dict) -> int | None:    ours = next((pos for pos, url, _ in outcome["results"]                 if urlparse(url).hostname in (MY_DOMAIN, "www." + MY_DOMAIN)), None)    db.execute("INSERT INTO checks VALUES (?,?,?,?,?,?,?)",               (run_at, kw, country, city, outcome["status"], ours, len(outcome["results"])))    db.executemany("INSERT INTO results VALUES (?,?,?,?,?,?)",                   [(run_at, kw, country, pos, url, title) for pos, url, title in outcome["results"]])    return oursdef main():    db = sqlite3.connect("ranks.sqlite")    db.execute("CREATE TABLE IF NOT EXISTS checks (run_at, keyword, country, city, status, our_position, n_results)")    db.execute("CREATE TABLE IF NOT EXISTS results (run_at, keyword, country, position, url, title)")    run_at = datetime.now(timezone.utc).isoformat(timespec="seconds")    with sync_playwright() as p:        browser = p.chromium.launch()        for kw, country, city, hl in KEYWORDS:            outcome = check(browser, kw, country, city, hl)            ours = store(db, run_at, kw, country, city, outcome)            print(f"{kw!r:18} {country}/{city or '-':10} {outcome['status']:8} position={ours}")            time.sleep(2)                   # pace yourself; a CAPTCHA costs bandwidth too        browser.close()    db.commit()if __name__ == "__main__":    main()

FAQ

Questions

Something not covered? Write to contact@arcproxies.io.

Can I build a rank tracker with Python requests and Beautiful Soup?

Not for Google any more. Since January 2025 Google Search requires JavaScript, so a plain HTTP fetch does not return a results page. You need a browser such as Playwright's Chromium, with Beautiful Soup or DOM queries for the parsing step.

Is it legal to scrape Google rankings?

We cannot give legal advice. What is factual: Google's Terms of Service forbid automated access that violates the machine-readable instructions on its pages, and its robots.txt disallows /search. For your own site, the Search Console API gives average positions without scraping.

How do I check rankings for a specific city?

Send the check through an exit in that city: add a _city- token to the proxy username, for example _city-manchester. City targeting covers 38 metros in 12 countries and is metro-level, not street-level. Verify the exit with the proxy location checker first.

Why does my tracker suddenly report that every keyword dropped out?

Almost always the parser, not the rankings: the markup changed and the selector matches nothing, or the checks hit a consent or CAPTCHA page. Store a status per check, save the page when an ok check parses zero results, and fix the selector against the saved page.

Should each keyword check use a new IP?

Yes. Use one sticky session per check so the results page and its subresources share one exit, then a new session handle for the next check. That keeps checks independent and avoids carrying cookies or rate limits from one check to the next.

How deep should a rank tracker check?

The top 10 is one results page. Google appears to have stopped honouring num=100 in September 2025, so the top 100 can take up to ten page loads per keyword. Most teams check the top 10 daily and deeper positions weekly.

Next

Where to go from here