Skip to contents

Returns Google Maps reviews from places when using search queries (e.g., "restaurants, Manhattan, NY, USA") or from a single place when using Google IDs or names (e.g., "NoMad Restaurant, NY, USA", "0x886916e8bc273979:0x5141fcb11460b226"). In addition to the reviews, it returns places information.

Usage

google_maps_reviews(
  query,
  reviews_limit = 10,
  reviews_query = NULL,
  limit = 1,
  sort = c("most_relevant", "newest", "highest_rating", "lowest_rating"),
  last_pagination_id = NULL,
  start = NULL,
  cutoff = NULL,
  cutoff_rating = NULL,
  ignore_empty = TRUE,
  language = "en",
  region = NULL,
  fields = NULL,
  async = FALSE,
  ui = FALSE,
  webhook = NULL,
  api_key = Sys.getenv("OUTSCRAPER_API_KEY")
)

Arguments

query

(chr) the query you want to search. You can use anything that you would use on a regular Google Maps site. Additionally, you can use google_id (feature_id), place_id, or CID.

reviews_limit

(int, default = 10) The parameter specifies the limit of reviews to get from one place (0 = unlimited).

reviews_query

(chr) The parameter specifies the query to search among the reviews (e.g. wow, amazing | great).

limit

(int, default = 10) The parameter specifies the limit of organizations to take from one query search.

sort

(chr, default = "most_relevant") one of the sorting types: "most_relevant", "newest", "highest_rating", "lowest_rating".

last_pagination_id

(chr) the review_pagination_id of the last item. It's commonly used in pagination.

start

(int) the start timestamp value for reviews (newest review). The current timestamp is used when the value is not provided. Using the start parameter overwrites the sort parameter to newest. Therefore, the latest reviews will be at the beginning.

cutoff

(int) the oldest timestamp value for reviews (oldest review). Using the cutoff parameter overwrites sort parameter to newest. Therefore, the latest reviews will be at the beginning.

cutoff_rating

(int) the maximum for lowest_rating sorting or the minimum for highest_rating sorting rating for reviews. Using the cutoff_rating requires sorting to be set to lowest_rating or highest_rating.

ignore_empty

(lgl, default = TRUE) whether to ignore reviews without text or not.

language

(chr, default = "en") the language to use for website.

region

(chr, default = NULL) the country to use for website. It's recommended to use it for a better search experience.

fields

(chr) which fields you want to include with each item returned in the response. By default, it returns all fields. Use &fields=query,name to return only the specific ones.

async

(lgl, default = FALSE) The parameter defines the way you want to submit your task to Outscraper. It can be set to FALSE to open an HTTP connection and keep it open until you got your results, or TRUE to just submit your requests to Outscraper and retrieve them later (usually within 1-3 minutes) with the Request Results endpoint. Each response is available for 2 hours after a request has been completed.

ui

(lgl, default = FALSE) whether a task will be executed as a UI task. This is commonly used when you want to create a regular platform task with API. Using this parameter overwrites the async parameter to true.

webhook

(chr, default = NULL) defines the URL address (callback) to which Outscraper will create a 57POST request with a JSON body once a task/request is finished. Using this parameter overwrites the webhook from integrations.

api_key

(chr, default = Sys.getenv("OUTSCRAPER_API_KEY")) Your API key. You can get it by registering on Outscraper.

Value

a tibble of reviews from Google Maps based on a given search query (or many queries).

Details

Queries

The example of valid queries:

  • Real estate agency, Rome, Italy

  • The NoMad Restaurant, NY, USA

  • restaurants, Brooklyn 11203

  • 0x886916e8bc273979:0x5141fcb11460b226

  • ChIJrZhup4lZwokRUr_5sLoFlDw

  • etc.

It supports batching by sending arrays with up to 250 queries (e.g., query=text1&query=text2&query=text3). It allows multiple queries to be sent in one request and save on network latency time. You might want to check out the web application to play with locations and categories that we would suggest.

Async

A good practice is to send async requests and start checking the results after the estimated execution time. Check out this Python implementation as an example.

As most of the requests take some time to be executed the async = TRUE option is preferred to avoid HTTP requests timeouts.

Optimization

In case no reviews were found by your search criteria, your search request will consume the usage of one review.

This endpoint is optimized for fast responses and can be used as a real-time API. Set the reviewsLimit parameter to 10 to achieve the maximum response speed.

Examples

if (FALSE) {
  # single
  google_maps_search("pizzeria, New York", limit = 1)[["place_id"]] |>
    google_maps_reviews(reviews_limit = 2) |>
    dplyr::pull("reviews_data") |>
    purrr::pluck(1) |>
    dplyr::select(review_text)
}