DEV Community

Victoria
Victoria

Posted on

How to Check Google Rankings from Any Location Without a VPN

Ever tried to check how your site ranks in a different city or country, only to get the same local results you always see? It’s one of those small frustrations that can mess with your SEO strategy. I’ve been there—thinking my rankings were solid, only to realize later that I was only seeing results biased by my own location. That’s where a simple, code-driven approach can help.

The trick is to simulate a local search query by spoofing your geographic location. Instead of VPN hopping or asking friends across the globe, you can use tools that manipulate the gl (country) and hl (language) parameters in Google search URLs. For example, searching for “best coffee shops” in Berlin, Germany, as if you were there? Just add &gl=de&hl=de to your URL.

But to scale this for SEO analysis, you can build a tiny script. Here’s a Python snippet using requests to fetch search results for multiple locations:

import requests
from bs4 import BeautifulSoup

def spoof_local_search(query, country, language):
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
    }
    params = {
        'q': query,
        'gl': country,
        'hl': language,
        'num': 10
    }
    response = requests.get('https://www.google.com/search', headers=headers, params=params)
    return response.text

# Example: Search for "digital marketing agency" from France
html = spoof_local_search("digital marketing agency", "fr", "fr")
soup = BeautifulSoup(html, 'html.parser')
for result in soup.select('.tF2Cxc'):
    title = result.select_one('h3')
    link = result.select_one('a')
    if title and link:
        print(f"{title.text}: {link['href']}")
Enter fullscreen mode Exit fullscreen mode

This script changes the gl parameter to simulate a user in France. You’ll get results tailored to that region, without leaving your desk. It’s perfect for checking if your site shows up in Parisian searches or if a competitor dominates a specific market.

But here’s where it gets practical: I often need to test multiple cities, languages, and even regions within a country. Manually running this for 50 locations is tedious. That’s why I use a dedicated tool like the SERPSpur Local Search Spoofing Tool. It does exactly this under the hood, letting me pick a country, city, region, or language and instantly see what locals see. No code, no VPNs, no guesswork.

For example, last week I needed to check visibility for a client’s service pages across three German cities. With the tool, I set the location to Munich, Hamburg, and Berlin separately, and spotted that one page wasn’t ranking in Hamburg due to a missing local keyword. That insight came in minutes.

The bottom line: local search spoofing is a must for anyone doing location-based SEO. Whether you use a script or a ready-made tool, the goal is the same—see the search landscape as your target audience does. It saves time, eliminates bias, and helps you make data-driven decisions. Give it a try on your next audit.

Top comments (1)

Collapse
 
dylan_parker123 profile image
Dylan Parker

Great question! I actually faced this exact issue last week and solved it by caching the results, which sped things up significantly.