Why use Location Parameters?

When you perform a live search in your browser, Google uses your location to personalize your results so they are relevant to you. When using SerpApi, this is important, as the location used affects the results returned.

Being able to change the origin of your search to different locations also allows you to check the local SEO of those locations. Click here to read about local SEO:

Real World Example of GPS Targeted Local SERP
This blog discusses local SEO, local SERP, and the UULE parameter. An Example code is given for precision search results using GPS coordinates.

And click here to read about global SEO strategies:

Global SEO: Strategies for International Success
Boost global SEO success with language, localization, technical SEO, content, link building, and outreach strategies for international visibility

Besides being important for SEO, location parameters allow you to collect data relevant to a specific region, get results in a specific language, and accurately emulate a real user's search.

Do I need to use a location?

Sometimes it feels restrictive to need to provide location parameters in your searches. What if you don't want to just search one city? What if you want to search nationwide, or even worldwide?

The thing to keep in mind is that all searches have a point of origin. It's not possible to connect to the internet without an IP address. There are many tools available for disguising your IP address- VPNs, proxies, TOR, but there is no way to search without using an IP address.

When you access any web page, including a search engine like Google, the owner of the website gains access to your IP Address. They can then use this to determine your location. The tools mentioned above can be used to provide a fake or alternative IP address, which can make it seem like you are located somewhere else. However they can't provide a "generic" location or make it seem like you aren't located anywhere.

When SerpApi receives a GET request, we perform a live search using the engine and parameters specified. If you don't provide a location parameter, Google will still try to guess your location using the IP address of the proxy where the search was performed.

This is usually not what we want. It provides very little control. Since we don't know which proxy will be used the location will be random. You may think the location doesn't matter for your search - but remember that Google serves locations all over the world. If you don't specify the location,  you may get back results for United States, Poland, Singapore, or Brazil. You may not find it helpful to get back results in a language you don't speak.

Google may also identify the search as suspicious and slow down or block it.

Whenever you use SerpApi to scrape data from search engines, keep in mind that the goal is to simulate a real user's search. All real users have a physical location and Google can determine this location (even if sometimes not accurately).

This is why we encourage our users to always specify locations at the city or district level.

If you want to know which specific locations are supported, we have an API for that. Our Locations API is free to use (it doesn't cost a search credit). You can also download the full JSON file (more on supported locations later).

How to Search Nationwide

If you are using Google Jobs, Google Maps, or Google Local and you want to search a larger area this is still possible. Think about how you would perform this search in your browser. If you are searching Google Jobs for barista jobs across the U.S for example, not just in Austin, Texas, you can still use "Austin, Texas, United States" as the value of the location parameter. But in your query you can add "in the United States", just as you would if you were performing a search in your browser.

If you are searching in Google Maps and you want to search for coffee shops in the U.S, rather than in a particular City, you will still need to supply GPS coordinates. If you have your GPS Coordinates set to @40.7455096,-74.0083012,14z, the coordinates for New York City, and you search for Coffee, you will get results for New York. However you can decrease z, which will zoom out and include results from a wider region. You can also try adding "in United States" to your query. You may still find that results near the GPS coordinates specified are still prioritized. Another approach you can use to avoid this is to use GPS coordinates in another country and then query "Coffee in United States".

Unfortunately, I can't fully recommend any of the methods above for most purposes. The reason is that Google displays a limited number of results for any search. So even if you use one of the above techniques to perform a "nationwide" search, you won't get all of the results for the country you are searching in, just some number of the top results, depending on which engine you are searching with. The best way to get an extensive set of "nationwide" results is to break it down and search city by city or region by region.

Different APIs Take Different Parameters

Different search engines require different formats for the parameters they accept. In addition, when we support a parameter that is directly supported by the search engine itself, we try to use the same name they do. Names and possible values can therefore be very different depending on which API you are using.

For this reason it is usually best to look up the documentation when using a particular API for the first time.  

We will briefly discuss the specific location parameters for a few of our APIs below:

Google

To specify a specific geographic location, you have a choice between location and uule when using our Google Search API. We use uule for all of the searches we perform on our side, but we provide the location parameter (and convert it to uule) so that you can just specify a name without having to look up the uule.  As mentioned above, you can access our supported locations using our Locations API.

Most of our Google APIs support location and uule. Some exceptions are Google Maps and Google Lens, as these work differently than Google's other services.

Our Google Search API also supports gl for country, hl for language, and google_domain - which allows specifying one of the various domain names Google uses to serve different countries. These parameters are categorized as "localization" parameters. They are not necessarily pinned to a particular geographic location in the same way that uule and location are, but they are parameters supported by Google for personalizing results based on a locale.

Google Maps

Instead of using the uule parameter, Google Maps requires ll, a string that includes longitude, latitude and zoom distance. It is constructed  like this:

@ + latitude + , + longitude + , + zoom

For example @40.7455096,-74.0083012,14z.

If you don't have the GPS coordinates from the location you want to search, you can query our free Locations API to get them.

Bing Search API

Like our Google Search API, our Bing Search API has a few options. If you know the GPS coordinates, you can use the lon and lat parameters. If you don't know them, you can use location to specify a name. We convert location to lat and lon on our side, similar to the way we convert location to uule for Google. You can find out all of the supported locations using our supported locations api.

Bing also has a parameter mkt or "market". This parameter accepts a "market code", a string that includes a 2 letter language code, and a 2 letter country code. For example, the United States has two market codes,  en-US es-US for Spanish. Often this directly represents the country where the search originates. However Bing doesn't have a unique market code for every country. If the search originates from a country that doesn't have it's own Bing market code, the nearest market code is used. You can see all of Bing's market codes here. When querying the Bing Search API, you can alternatively use cc or "country-code" - similar to Google's gl. However using mkt may return more consistent results, as it helps Bing to accurately route the request.

Yandex

Our Yandex Search API takes a yandex_domain and a lang parameter for localization. We keep lists of supported values for Yandex Domains and Yandex Languages.

Yandex also takes a lr parameter, to be used with any domain except the default yandex.com domain. This parameter allows specifying a region or country. This parameter is important to be aware of when searching Yandex, as it changes the rules for sorting and ranking the results. You can look up the possible values for lr here: https://serpapi.com/yandex-locations.

Other

We won't go into all of the search engines and their various location parameters. Just know that each of our APIs has it's own unique set of parameters. Even our various Google APIs can have differences in supported parameters.

It's always best to check the documentation if you're using an API for the first time, or if you're not sure.

Locations API

When you use the location parameter with Google or Bing, to specify a named location, we convert it to either UULE (Google) or GPS (Bing). To do this we use a list of supported locations. You can access these locations with our Locations API or download the full JSON file for a full list. These are derived directly from Google's list of unique Google Ad's locations, or "Geo targets".

As mentioned above, we also use these with Bing, in order to convert named locations to GPS coordinates. If you are using the Bing Search API, and you want to use a specific location not on the list, you can use lon and lat parameters to specify the GPS coordinates yourself.

Conclusion

The basic takeaway is, location yes use it! By not using location parameters you are only surrendering control of an important factor in how search results pages are presented. And by using them you gain the ability to target a particular region for data collection or tracking SEO, greater consistency and reliability in results, and an experience that more closely mimics a real user's search.

It is best to use all of the supported location and localization parameters for any search. The exception, of course, being parameters that are mutually exclusive and can't be used together. Check out the documentation to see what these are.

We have also covered some of the details of how these location parameters work behind the scenes, so that you can have a better sense of what they are for and how they affect your search.

I hope you have found this article informative and easy to follow. If you have any questions, feel free to contact me at ryan@serpapi.com.