If you’re seeing the “For development purposes only” watermark on your Google Maps embed, it indicates that there is an issue with your API key. This guide will walk you through the steps to fix the problem and get Google Maps working on your website correctly.
Why Does This Happen?
The “For development purposes only” message appears when:
- Your Google Maps API key is not set up correctly.
- Your API key does not have billing enabled.
- The API key is restricted, preventing it from working on your domain.
Steps to Fix the Issue
Step 1: Get a Google Maps API Key
If you haven’t already, you need to create a Google Maps API key:
- Go to the Google Cloud Console.
- Log in to your Google account (or create one if you don’t have one).
- Create a new project or select an existing project.
- Navigate to APIs & Services > Credentials.
- Click Create credentials and select API key. This will generate a new API key that you can use.
Step 2: Enable Billing for Your Google Cloud Account
Google Maps API requires billing information to be enabled on your account, even for basic usage:
- Go to the Google Cloud Console.
- Select your project.
- Click on the Billing section.
- Add a payment method and set up billing if you haven’t done so. Google provides a free tier of usage, so in many cases, you will not incur charges unless your usage exceeds the free quota.
Step 3: Enable the Required APIs
Ensure the necessary Google Maps APIs are enabled:
- In the Google Cloud Console, select your project.
- Go to APIs & Services > Library.
- Search for “Maps JavaScript API” and click Enable.
- Depending on your use case, you may also need to enable other APIs like Geocoding API, Places API, and Directions API.
Step 4: Restrict Your API Key (Optional but Recommended)
To prevent unauthorized use, restrict your API key:
- Go to APIs & Services > Credentials in the Google Cloud Console.
- Select the API key you created.
- Under Key restrictions, choose:
- HTTP referrers (websites): Restrict the key to specific domains. For example, enter your website with a wildcard asterisk at the end, https://www.yourwebsite.com/*.
- Under API restrictions, select the APIs you wish to restrict (e.g., Maps JavaScript API, Geocoding API).
- Click Save.
Step 5: Update Your Website with the API Key
If you already have Google Maps embedded on your website, check the code to ensure the correct API key is being used. Look for the script tag in your HTML that loads Google Maps, and update the ‘key’ parameter with your new API key:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" async defer></script>
Replace YOUR_API_KEY with the API key you generated.
If you’re using a WordPress website you may need to enter your API key in your theme options or in a plugin.
Some WordPress plugins exist, such as API KEY for Google Maps which allow you to enter your API key and it will attempt to override the Google API key setting across your theme or plugins.
Step 6: Clear Cache and Test
After updating your API key:
- Clear your browser cache.
- Clear any server-side caching mechanisms (e.g., WordPress cache plugins).
- Reload your website to check if the “For development purposes only” message is gone.
Additional Tips
- Double-check that the correct API key is used on all pages where Google Maps is embedded.
- Make sure you have enabled the appropriate APIs for the functionality you need.
- If you encounter an error message in the browser’s developer console, search for the error code on the Google Maps Platform documentation.
Managed WordPress Plans
Are you looking for a reliable hosting provider that can help you manage your WordPress websites? Look no further than Ecenica. Our range of WordPress Hosting plans are designed to support multiple websites and provide you with the tools and support you need to manage them all easily.
With our plans, you can create as many WordPress websites as you need, whether you want to use subdomains or domain names. Our platform is optimized for WordPress, so you can expect top-notch performance, security, and speed for all your sites.
If you’re running into issues displaying your Google maps our support team can help. Sign up for one of our Managed WordPress Hosting plans today and take advantage of our expertise and support. Visit our website to learn more about our plans and get started today!