Skip to main content
how to create google maps api key

How to Create Google Maps Platform API Keys for WordPress Sites

Are you ready to elevate your website experience? Just like rolling the perfect joint, obtaining a Google Maps API key is a simple step towards modernizing your website while enhancing user satisfaction. The API key unlocks the ability to display custom maps on your website. Whether you want to highlight your dispensary’s location, showcase multiple store locations or simply flaunt the areas you serve in the cannabis community–Google Maps API keys are your ticket to letting your website visitors know just how close they are to your high-quality cannabis products and services.

Worried about the complexity? Don’t be! Whether you’re a fresh face in the Google Cloud universe or a seasoned user, it’s as straightforward as grinding your favorite strain. Let’s break it down:

In this blog, we’ll guide you through setting up Google Maps on your website in two different ways:

If you are a new Google Cloud user who DOES NOT have billing set up, an API Key will be magically generated for you upon signing up.

Get ready to: Generate an automatic Google Maps Platform API key for WordPress Sites

If you are a returning Google Cloud user and have your billing all sorted out, you will be taken to the ‘Credentials’ page, where you will create two of your own API Keys.

Prepare to: Create a Google Maps Platform API key manually

Let’s get into it!


How to Automatically Generate Google Maps Platform API Keys for WordPress Sites as a New User

To get started with creating your Google Maps Platform API key, head over to Google Maps Platform and follow the instructions below.

Step 1: Select ‘Get an API Key’ 

If you already have Google Cloud billing enabled, you will be redirected to the ‘Credentials’ section of the Google Cloud Console. ** Please skip to the manual setup section below and follow the manual setup steps. 

If you do NOT have Google Cloud billing enabled, keep reading!

Step 2: Create a Google Maps Platform Account

In order to get started, you will be required to create a new account and add your payment information. 

Keep in mind that Google gives you a $300 credit-free trial. After the trial is over, you will get 28,000 requests per month and 40,000 direction calls each month before being billed. These are high quotas to meet and atypical for a small business/startup, and Google does not bill until you exceed the $200 per month credit limit.

Step 3: Copy API Key & Head to Google Cloud Page 

Once you’ve set up your account and billing information, you will be given an automatically generated API Key. From here, select Google Cloud Console to be re-directed to the Google Cloud page.

Step 4: Ensure Proper APIs are Enabled 

Welcome to the home page! Before we edit your API Key, you will need to check your APIs and Services to ensure you have the correct map products enabled. These are generally enabled by default when your API Key is auto-generated. However, there are times when this must be done manually. 

First, click on APIs & Services: 

Next, enable the following products:

  • Javascript API
  • Geocoding API
  • Directions API
  • Distance Matrix API
  • Elevation API
  • Places API & Places API New
  • Static Maps API

Step 5: Setting Up HTTPS (Website) Restrictions 

Now that you have enabled the correct API products head back to the API Keys by selecting Keys & Credentials on the left side, clicking the three dots, and ‘Edit API Key.’ 

From here, you will need to set up restrictions for your API Key.

  • First, set up an application restriction for ‘Websites’ (previously called HTTP referrers).
  • Under ‘Website Restrictions,’ select ADD and enter the name of your domain *yourdomain.com/

  • Next, set up API restrictions for API Key 1. It’s important to note that you should only do this for ONE of your API Keys for Google Maps Platform. 
  • Select Restrict Key 
  • Add the following APIs:
    • Javascript API
    • Geocoding API
    • Directions API
    • Distance Matrix API
    • Elevation API
    • Places API & Places API New
    • Static Maps API
  • Save 

After saving your API edits, you will be taken back to the Google Maps Platform home screen. Your API Key should show a green checkmark next to it and indicate that your restrictions are on for HTTP referrers with 7 APIs.

Step 6: Create Second API Key 

Now that you have completed your first API Key setup, it’s time to set up the second API Key. This API Key is known as the ‘server-key’ and is used by Google Maps Geocoding to create coordinates from an address. 

Start by selecting ‘+Create Credentials’ and clicking ‘API Key.’ 

This will automatically generate a new API Key. 

Now, you will need to set up restrictions for your second API Key by selecting ‘Edit API Key.’

Step 7: Setting Up IP Address Restrictions 

For API Key 2, you will want to set up restrictions for IP addresses.

  • Select IP addresses
  • Enter your IP address
  • Save 

**Remember, you are NOT setting up Key Restrictions for this API Key. 

Step 8: Verify Both API Keys 1 & 2 

Once you have saved the settings for API Key 2, you will be redirected to the home page of Google Maps Platform. 

Your screen should show both API Keys 1 & 2 with green check marks.

Creating a Google Maps Platform API Key Manually

The process for manually creating a Google Maps Platform API Key is similar to the automatic version above. After navigating to the Google Maps Platform, click the ‘Get Started Button’ and log into the Google account that is associated with your account. 

If you do not have an account, you will need to set up billing and start a free trial. 

Step 1: Select ‘Get Started’ and log into your Google Cloud account

Step 2: Enable Proper APIs 

Before you set up restrictions on your API Key, you must manually enable the proper APIs and Services products.

First, click on APIs & Services: 

Next, enable the following products:

  • Javascript API
  • Geocoding API
  • Directions API
  • Distance Matrix API
  • Elevation API
  • Places API & Places API New
  • Static Maps API

Step 3: Create API Key 1 

Once you’ve enabled the proper API service products, you will be ready to create API Key 1. This API Key is known as the ‘browser key’ and is used when Google Maps JavaScript requests data from the front end of your site. 

  • Select Keys & Credentials
  • + Create Credentials
  • API Key 

This process will automatically generate an API key for you. 

Step 4: Set Up Website Restrictions 

Now that you have enabled the correct API products head back to the API Keys by selecting Keys & Credentials on the left side, clicking the three dots, and ‘Edit API Key.’

From here, you will need to set up restrictions for your API Key. 

  • First, set up an application restriction for ‘Websites’ (previously called HTTP referrers).
  • Under ‘Website Restrictions,’ select ADD and enter the name of your domain *yourdomain.com/

  • Next, set up API restrictions for API Key 1. It’s important to note that you should only do this for ONE of your API Keys for the Google Maps Platform. 
  • Select Restrict Key 
  • Add the following APIs:
    • Javascript API
    • Geocoding API
    • Directions API
    • Distance Matrix API
    • Elevation API
    • Places API & Places API New
    • Static Maps API
  • Save

After saving your API edits, you will be taken back to the Google Maps Platform home screen. Your API Key should show a green checkmark next to it and indicate that your restrictions are on for HTTP referrers with 7 APIs.

Step 5: Create Second API Key 

Now that you have completed your first API Key setup, it’s time to set up the second API Key. This API Key is known as the ‘server-key’ and is used by Google Maps Geocoding to create coordinates from an address. 

Start by selecting ‘+Create Credentials’ and clicking ‘API Key.’ 

  • This will automatically generate a new API Key. 

Now, you will need to set up restrictions for your second API Key by selecting ‘Edit API Key.’

Step 6: Setting Up IP Address Restrictions 

For API Key 2, you will want to set up restrictions for IP addresses.

  • Select IP addresses
  • Enter your IP address
  • Save 

**Remember, you are NOT setting up Key Restrictions for this API Key. 

Step 7: Verify Both API Keys 1 & 2 

Once you have saved the settings for API Key 2, you will be redirected to the home page of Google Maps Platform. Your screen should look like this: 

This is just one step you can take toward creating a better user experience on your website. Let us help you create a more user-friendly, well-designed, search-engine-optimized website. Contact us today.

Leave a Reply

Your email address will not be published. Required fields are marked *