GS Location Changer for Chrome and Firefox
by Valentin Pletzer - June 11th, 2020
A free Chrome extension and Firefox Add-on to change the location of your Google Search to get localized SERPs at an exact location.
Why you might want to change your location
The GS location changer (GS short for Google Search) is a browser plugin to emulate any location on google.com. This is needed because end of 2017 Google decided to remove the possibility to use ccTLDs as a mean to switch countries. But even if you could change the country by using a different ccTLD like .de for Germany or .es for Spain there is a certain need to change your exact location because Google, depending on the query, shows completely different search results to different people.
This makes total sense: Let’s say you live in New York and you search for [pizza near me] you would expect results which are actually near you, so depending on whether you live in Brooklyn or Queens you will see completely different results (try for yourself in the Google Search Mobile Device Simulator). The local pack (a onebox listing local stores) often changes if you are just one block down the road. So if you want to check those Google SERPs (search engine result pages) and are not able to visit those places physically, you need a way to fake your location and this can be done with the GS location changer.
How Google knows where you are
There are two basic ways Google can easily detect your current location: First one being your IP address. Typically an ISP (Internet Service Provider) has a range of IP addresses for a specific region. This allows Google (and others) to roughly estimate your location – typically on a city-level. The second option is simply to ask you or rather ask for permission to access the Geolocation API provided by your browser. The Geolocation API will ask the Operating System which in turn relies on the hardwares capabilities. If your device has access to GPS and does find six satellites it can locate you down to within 3 metres. In other cases nearby known Wifi-networks may be used to triangulate your position to a much rougher estimate. You can try this yourself here in my article/tool: Where am I now?
So now Google knows your location, it will store the data for later use in a cookie called UULE and also on it’s databases. While both can be removed most people probably won’t do that because they don’t know or don’t care. And we really don’t know what Google does use this data for, but personalizing your search results is most certainly an option.
How the browser plugin works
Both browser plugins (the Chrome extension or the Firefox Add-on) work exactly the same. You can choose a host language (hl) and a geo location (gl) which will set the “Accept-Language” http header of your request to google.com. The browsers infer those values by the language choices you made in your operating system. While the plugin only allows for a very simple setting of one language and one location this can be much more complex in reality if you have chosen more than just one language setting in your operating system.
Next you choose your exact location by setting a latitude and longitude. You can either enter something manually or you enter an address in the input field “location” and hit the button “geocode”. This will send the address to the Google Maps Geocoder API and return the latitude and longitude of the most probable location. (Since this also overrides the input you can double check if it got it right.). The coordinates will converted in the UULE format and set in the http header “X-Geo”, a proprietary header the Google server make use of.
All that is left is to check the box “enable overwrite” to activate your settings and later to uncheck it. Once you uncheck the overwrite option, the plugin will also try to delete the UULE cookie because as explained a few paragraphs before this is where Google will store the location as well and this will most likely interfere with your normal searches.
Where to find the code
I decided to share the code of the Chrome extension on Github. I am not a professional developer and the code most certainly could be improved a lot but it isn’t obfuscated and other than the UULE code and the use of the X-Geo-header everything used is very well-known. So if you have improvements for my code: just let me know.
If you like this article, experience any problems, have ideas for upgrades or just want to say hi, feel free to contact me on Twitter @VorticonCmdr.