Skip to content

Creating Google Maps API Keys

WP-ImmoMakler requires two separate Google Maps API keys: a server-side key for background operations and a browser-side key for displaying maps on your website.

Google Cloud Console overview of enabled APIs for a WP-ImmoMakler project

Using the Google Maps APIs requires a Google account with a linked billing account. Google requires you to provide a bank account or credit card, even if you do not exceed the free quota. In practice, even estate agents with several hundred properties and high website traffic stay within the monthly free quota, so no additional costs are typically incurred.

This key is used for the following functions:

  • Automatic geocoding of property locations (Geocoding API)
  • Maps in the PDF print view (Maps Static API)
  • Address autocomplete in the backend (Places API)

APIs to enable:

Restriction: Restrict this key to the IP address of your server. Your server’s IP address is displayed directly in the WP-ImmoMakler settings.

Google Cloud Console settings for the server-side API key with IP address restriction

Key 2: Browser-Side API Key (JavaScript API Key)

Section titled “Key 2: Browser-Side API Key (JavaScript API Key)”

This key is used for the following functions:

  • Map display on your website (Maps JavaScript API)
  • Address autocomplete in the search form (Places API)

APIs to enable:

Restriction: Restrict this key to HTTP referrers, i.e., to the domain(s) of your website. Add a wildcard asterisk at the end of the domain so that all subpages work correctly, for example: https://www.your-website.com/*

Google Cloud Console settings for the browser-side JavaScript API key with HTTP referrer restriction

The browser-side key is publicly visible in your website’s source code. For security reasons, API keys should therefore be restricted so that no third parties can use your keys at your expense. However, a single API key can only be restricted to IP addresses or to domain names, not both at the same time. Since the Geocoding and Static Maps APIs are called from the server (restricted to the server IP), while the JavaScript and Places APIs are called from your visitors’ browsers (restricted to the referrer domain), you need two separate keys.

Enter the created keys in the backend of your website (wp-admin) under WP-ImmoMakler > Integrations. They live in two different tabs, because they do two different things:

  • The browser-side key in the Maps tab, in the JavaScript Key field. It is needed for the maps in your visitors’ browsers.
  • The server-side key in the Geo Services tab, in the Geocoding Key field. It is needed for geocoding, the map preview images, and address suggestions.

If you encounter any problems setting up the keys, feel free to contact our support team. We are happy to set up the keys together via screen sharing.

If you would like to design your maps individually or highlight postcode areas in colour, you also need your own map ID — see Creating a Google Maps map ID.

Fast-API Proxy Storage Location for Address Autocomplete

Section titled “Fast-API Proxy Storage Location for Address Autocomplete”

To ensure address autocomplete in the radius search responds quickly, WP-ImmoMakler places a small PHP script (immomakler-autocomplete.php) on your website. The script accepts input from the search form, forwards it server-side to the Google Places API (New), and returns the suggestions — without loading the full WordPress core. This makes the suggestion list significantly faster, and the Google Maps API key stays exclusively on the server and is not sent to the browser.

Default: wp-content/cache/immomakler/fast-api/immomakler-autocomplete.php

Together with the script, a file .immomakler-autocomplete-secrets.php is placed, which contains the Google Maps API key, the allowed origin URLs, and the configured countries and search area. Both files are automatically updated whenever the corresponding settings change.

In the backend of your website (wp-admin) under WP-ImmoMakler > Integrations > Geo Services, you will find the setting Address Autocomplete Radius Search: Fast-API Proxy Storage Location. The available options are:

  • wp-content (Default) – the files are stored under wp-content/cache/immomakler/fast-api/. Recommended for all new installations.
  • Root directory – the files are stored directly next to wp-config.php. Fallback for installations where a security plugin such as Wordfence or iThemes Security blocks the execution of PHP files below wp-content/.

If address autocomplete in the radius search does not respond (empty suggestion list) and the plugin cannot establish a connection to the Fast-API proxy even after the page has loaded, it is usually because a security plugin has blocked the execution of PHP files in the wp-content/ directory. In this case, switch the setting to Root directory. The radius search will continue to work regardless — WP-ImmoMakler uses the regular WordPress interfaces (REST API and admin-ajax) as an automatic fallback, though these routes are somewhat slower.

In WordPress Multisite networks, the wp-content storage location is always used for security reasons and cannot be switched to the root directory. Each website in the network receives its own subdirectory (e.g. wp-content/cache/immomakler/fast-api/2/ for the website with blog ID 2), so that each website can operate with its own Google Maps API key, its own country selections, and its own search area. The root directory is shared by all websites in the network — placing credentials there would therefore cause all websites to use the same API key, which is not desirable in multisite setups with different owners.

If WP-ImmoMakler displays the notice “WP-ImmoMakler: Places API (New) not activated” in the backend of your website (wp-admin), the Places API (New) is either not activated for your Google Server API key in the Google Console or not selected under the key’s API restrictions. Address autocomplete in the radius search will not work in this case.

Solution:

  1. Open the Places API (New) in the Google Console and activate the API for your project.
  2. Open the affected Server API key under API credentials and add the Places API (New) to the list of allowed APIs under “API restrictions”.
  3. Open the settings page in the backend of your website (wp-admin) under WP-ImmoMakler > Integrations > Geo Services — WP-ImmoMakler automatically tests the key when the page loads. If the test was successful, the notice disappears.