Ever noticed how your search results look completely different when you use a VPN? That's because Google personalizes results based on your IP, not just your query. This is a nightmare for SEO pros trying to audit local visibility.
I built a Python script that bypasses this by sending requests with custom headers and geolocation data. Here's a simplified version:
python
import requests
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
'Accept-Language': 'en-US,en;q=0.9',
'X-Forwarded-For': '8.8.8.8' # spoof IP
}
params = {
'q': 'coffee shop',
'gl': 'us', # country
'hl': 'en', # language
'uule': 'w+CAIQICINVXNhIE5ldyBZb3Jr' # encoded location
}
response = requests.get('https://www.google.com/search', headers=headers, params=params)
print(response.text[:500]) # check if results are localized
This is great for one-off tests, but managing multiple locations and languages quickly becomes tedious. That's why I now use a dedicated tool that automates all this with a simple API call. It's been a game-changer for my international SEO workflow.
Top comments (1)
The IP-based personalization is indeed a huge pain for accurate local audits. Your script is a good starting point, but I’ve found that even with custom headers, Google sometimes still catches on. Do you ever run into CAPTCHA issues with repeated requests?