Google Company Profile Logo
Auto update Google reviews
Johannes Luger
Johannes Luger

Head of SEO @SEOschmiede

Auto update Google reviews

Discover the easy way to boost your WordPress website's credibility and impress potential customers by automatically displaying Google reviews. With a custom shortcode, you can get the reviews directly from Google Places API and embed them seamlessly into your website. In this article, we'll show you step-by-step how to use this

Definition: Google reviews play a crucial role in the online presence of businesses, as they increase customer trust and improve visibility in local search results. These reviews are part of Google Business Profiles (formerly known as Google My Business), which allow businesses to showcase their information such as hours of operation, contact information, photos and, of course, reviews. Positive reviews can increase trust in your business and attract new customers, while negative reviews may turn potential customers away.

Content:

Learn how to automatically display Google reviews on your WordPress website. Learn how to create a custom shortcode and insert it seamlessly into your website. Also, discover how you can use the shortcode in Elementor Page Builder or WordPress Editor to build trust with your potential customers and increase the credibility of your business.

Step 1: Add code

Add the following code to your functions.php. To navigate to the functions.php file, you must first access your WordPress dashboard. Click on "Design" and select "Editor" from the dropdown menu. This will open up the code editor. In the right column, you will find a list of files that you can edit. Click on "functions.php" to open them.

Attention: Changes to the functions.php file can affect the behavior of your WordPress website, so you should always back it up before making any changes.

    
     function fetch_google_rating() {
    $api_key = 'YOUR_API_KEY';
    $place_id = 'YOUR_PLACE_ID';

    $url = "https://maps.googleapis.com/maps/api/place/details/json?place_id={$place_id}&fields=rating,user_ratings_total&key={$api_key}";
    $response = file_get_contents($url);
    $data = json_decode($response, true);

    if ($data['status'] == 'OK') {
        $rating = $data['result']['rating'];
        $total_ratings = $data['result']['user_ratings_total'];
        return "{$rating} ✪✪✪✪✪ bei {$total_ratings} echten Bewertungen";
    }
    return "Bewertungen konnten nicht abgerufen werden";
}

function fetch_google_rating_shortcode($atts) {
    return fetch_google_rating();
}
add_shortcode('google_bewertung', 'fetch_google_rating_shortcode');

    
   

Change the output text according to your wishes - In this line you can make the adjustments:

"{$rating} at {$total_ratings} real ratings".

Step 2: Google Places ID

To find the Places ID for a specific location, you can use the Google Places API Place ID Finder page. Here is a step-by-step guide:

  1. Call the URL https://developers.google.com/maps/documentation/places/web-service/place-id?hl=de on.
  2. Click on the "Place ID Finder" link under "Tools".
  3. Enter the desired location in the search box.
  4. Click on "Search Place".
  5. Select the desired location from the list of results.
  6. The Places ID is displayed under the name of the place.

With these steps you can quickly and easily find the Places ID for a specific location. You have to enter the ID in the code in the field 'YOUR_API_KEY' replace

    $api_key = 'YOUR_API_KEY';

Step 3: Google API Key

Unfortunately, for the automatic query you need a Google API Key. This can be a little more involved, but don't worry. Just follow the steps in the guide to create your free Google API Key:

  1. Go to the Google Cloud Console at https://console.cloud.google.com/.
  2. Sign in with your Google account or create a new account.
  3. Click on the project you want to use or create a new project.
  4. Click on the navigation and select "APIs & Services".
  5. Click on "ENABLED APIS AND SERVICES".
  6. Search for "Google Places API Web Service" and click on the API.
  7. Click on "Activate".
  8. Click on "Credentials" in the navigation.
  9. Click on "Create credentials" and select "API key".
  10. Your API key is created and displayed. Copy the API key and paste it into the code instead of "YOUR_API_KEY".

Step 3: Insert shortcode

    
     [google_rating]
    
   

Awesome, you are now ready to use the custom shortcode! To insert it, you just need to paste it in the desired place on your website. Depending on where you want to display the rating, you can insert the shortcode in an HTML widget or page builder. Once you insert the shortcode, the rating and the number of reviews will be automatically retrieved from your Google Business Profile and displayed on your website. Don't forget to save the changes and refresh your website so that the shortcode is displayed correctly.

How can I update Google reviews automatically?

In order to automatically update Google reviews on a WordPress website, one must first create a custom shortcode that will retrieve the reviews directly from the Google Places API and seamlessly integrate them into the website. To do this, one needs to add the code for the query to the functions.php file and insert the Google Places ID and Google API Key previously obtained by using Google tools like the Place ID Finder and Google Cloud Console. Once the custom shortcode is created, it can be inserted anywhere on the website to automatically retrieve and display the rating and number of reviews from Google business profiles.

Frequently asked questions

In order to automatically update Google reviews on a WordPress website, one must first create a custom shortcode that will retrieve the reviews directly from the Google Places API and seamlessly integrate them into the website. To do this, one needs to add the code for the query to the functions.php file and insert the Google Places ID and Google API Key previously obtained by using Google tools like the Place ID Finder and Google Cloud Console. Once the custom shortcode is created, it can be inserted anywhere on the website to automatically retrieve and display the rating and number of reviews from Google business profiles.

The exact time it takes for Google ratings to update depends on several factors, such as API request speed, server performance, and network connection. However, as a rule, the updated ratings should appear on your website within a few minutes after the shortcode is inserted and the API request is successful. However, it may take a little longer depending on how often the ratings are updated.

Important note on use

OpenAI collects data from your input - you should be aware of that! If you use our tool, your data will be transmitted directly to OpenAI and processed there. We as SEOschmiede have no influence on this! Tip: Do not share any personal information or information that could be used to identify you as an individual.

As SEOschmiede we have no control over the generated responses from OpenAI. ChatGPT (more precisely GPT-3.5-Turbo) is a learning computer algorithm that operates based on a variety of training data and algorithms. The answers are generated automatically and we cannot take any responsibility for the correctness or appropriateness of the answers.

Type of dataExamples
Personal data

Name, contact information, account credentials

User contentInput, file uploads, or feedback sent to the Services.
Communication dataName, contact information and content of messages
Social media dataContact details provided on social media sites
Log dataIP address, browser type and settings, date and time of the request, interactions with the website
Usage dataContent displayed, functions and actions used, time zone, country, date and time of access, device name, operating system and browser
Device informationDevice name, operating system and browser
CookiesInformation about your use of the Services and your preferences
Analytics dataInformation about how users use the services

You can find more information in the OpenAI Privacy Policy

We pay for your answers! Not a joke, but a fact. We like to do this, but get annoyed when some Wooden heads out there do not appreciate and give us bad reviews because they are not satisfied with the answers.

Already rated?

The use of our AI tools costs us Money. Can you provide us with a 5 star rating help? That would be fine and makes it possible that this tool is still available for free for everyone.