Geographic Location and Localization parameters on SerpApi’s Google Search API
SerpApi’s Google Organic Search API has many parameters to create a very specific request to scrape data. In this walk-through we will talk about the following parameters; location
uule
google_domain
gl
hl
and lr
. All these parameters are able to be used to improve a localized result for your query.
When opening up the demonstration playground in SerpApi, it can be a bit overwhelming. But don’t worry, all these fields that may seem a bit redundant at first are working in your best interest to create the most accurate search.
The first field that we want to explore in the top left corner is the Geographic Location card. The parameter :location
is able to be manipulated. This will direct a search to Google with a particular location in mind.
Users are able to use the drop down to see what is available to use. Although SerpApi has no affiliation with Google, our location parameter is bound to the parameters that Google uses. We can not use location parameters that Google does no support.
In the drop down, No Selection is available, which omits the location
from the search parameters. And then popular locations like: United States, Brazil, Mexico, Japan Indonesia. The drop down is a sure fire way to make sure you are using a supported location
field. You can simply just start typing in a specific location and a few results will appear. The full list of acceptable locations can be found with our Supported Locations API , or you can download the full JSON list here: locations.json .
When typing in “los angeles” there are a many different areas to target with your searches; “Los Angeles, CA, California, United States”, “Los Angeles County, California, United States”, “Los Angeles, California, United States”, “South Los Angeles, California, United States”, “East Los Angeles, California, United States”, “Chinatown, Los Angeles County, California, United States”. All of these are able to be used.
Users can see the location_requested
and the location_used
in the playground below:
The uule
parameter that is below the location
parameter is a way to directly call on a supported location parameter rather than using the location
parameter
Taken from https://valentin.app/uule.html blog:
The Google UULE parameter is used to encode a place or an exact location ?>(with latitude and longitude) into a value used in a cookie, an url or an http > header.
The uule
parameter can be found when the JSON response is sent back to a user when you used the location
parameter. For example when doing a query of “Coffee” in Los Angeles, California, United States with a Localization for Google.com, United States and in English. The uule
is found on the search_metadata
under the google_url:
uule=w+CAIQICIkTG9zIEFuZ2VsZXMsQ2FsaWZvcm5pYSxVbml0ZWQgU3RhdGVz
If you were looking to constantly search the same exact location parameters you could use the uule
as it is a Google encoded location parameter.
The next card on the playground helps refine your search in terms of localization are parameters that deal with domain, country and languages.
If you live outside the United States you are probably familiar with google pages other than google.com. As you can see with the drop down, we support 184 of them.
Here’s the full list of supported domains: https://serpapi.com/google-domains
And if you’d like to download the JSON: https://serpapi.com/google-domains.json
If you wanted to use Google.co.uk because you wanted to create a specific search with that domain being requested this is exactly the parameter for you.
The gl
parameter is what SerpApi mirrors Google with to support a given country. A bit different than a specific domain being queried.
Here’s the list of gl
parameters we support: https://serpapi.com/google-countries and if you wanted to download the full list: https://serpapi.com/google-countries.json
The final parameter we are looking to explore is the hl
parameter which handles the language.
Here’s the list of supported languages: https://serpapi.com/google-lr-languages
And a downloadable JSON:
https://serpapi.com/google-lr-languages.json
If you scroll through the list there are some easter egg’s hidden away. “Bork, bork, bork”, “Elmer Fudd”, “Hacker…
Using all of these different parameters can set you up with a real specific query that can span language and global position. Here’s a search for coffee in New York, New York, with a gl
parameter for the UK and the language hl
parameter being Japanese.
The possibilities are far and wide with the amount of customization you can put into a search query with Google. The important thing to take away is that all of these tools are used to create the most accurate query you may need for your needs. Querying “nba basketball scores” from a Google Japanese domain and have the results print out in Hacker might not be the most practical use case. But if that is what you want to search and get data from. SerpApi is able to do it.
You can sign-up for SerpApi here: https://serpapi.com/
You can find the SerpApi user forum here: https://forum.serpapi.com/
You can find the API documentation here: https://serpapi.com/search-api/