Follow below steps to create Google JavaScript Key,

1. Go to Google API Console Page, https://console.developers.google.com

2. Create or Select Project.

3. Enable below APIS in Library page.

  • Directions API,
  • Distance Matrix API,
  • Geocoding API,
  • Geolocation API,
  • Maps JavaScript API,
  • Maps Static API,
  • Places API,
  • Time Zone API

4. Then, Go to the Credentials page and get an API key

5. After you create the API Key, click Edit API Key to set restrictions.

 

6. Set Key Restrictions

  • Set HTTP Referrers and type your website URL: YOUR_SITE.com/*

7. Set API Restrictions

  • Click Restrict Key and select the APIs you made enabled.

Note: If you have an existing unrestricted API key, or a key with browser restrictions, you may use that key.