Guide 10. How to Enable Maps with Google Maps API

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000019818-guide-10-how-to-enable-maps-with-google-maps-api


In order to use the location search on your site, you will first need to get your own Google Maps Javascript API Key and add this to the Admin area of your site.

This will enable Google Maps to work on your domain name. In this article, we will guide you step by step on what you need to accomplish in order to make this great tool work!


[NOTE] Before completing this step, you must FIRST connect your live domain name.
Please See: How To Move A Site To A Live Domain.


Important Information: Due to a change in Google's policy, beginning on June 11, 2018, Google requires all users to add billing information to their account in order to activate Google Maps API keys.  

However, Google gives all users enough free credits each month so that the vast majority of websites will never have to pay anything for this service (as of writing this article, we are not aware of any Brilliant Directories websites ever having to pay for this service).  

In fact, with this update, Google is actually giving users even more free credit than before.  The only difference is that they now ask for billing information during the setup process rather than after a user consumes all of their free credits.


** IMPORTANT NOTE: If at some point you get redirected to a blank screen or different page or perhaps you suffer a connection issue; click on this link: https://cloud.google.com/maps-platform/ and select the "Get Startedbutton once more to continue the process.



Step 1

To get started, visit this link: https://cloud.google.com/maps-platform/



Step 2

After clicking on the "Get Started" button... You will be prompted enter the billing information:

  • Select the country and agree to the terms and condition in order to continue:



  •  Fill in your billing information and click on "Start My Free Trial":





Success! Click "START MY FREE TRIAL"



Step 3

Now you will be prompted to answer a set of questions.  Feel free to answer them based on your project:




Step 4

Now you can copy and paste the key which will appear below "Your API key":


* The key in the image below has been removed for key privacy*
* Make sure to select the "Enable all Google Maps APIs for this project" option




Step 5 

Choose the restriction type HTTP referrers (web sites) and add your domain as one of your referrers: 



Once that first restriction is setup, there are some more HTTP referrers to be added so click on Credentials:




Then Click on the API key name:


Step 6

THIS STEP IS EXTREMELY IMPORTANT.
PLEASE BE SURE TO COMPLETE THIS CORRECTLY.


Select HTTP referrers (websites) 


For the purposes of this tutorial, let's imagine that the domain of my website will be on is http://www.ilovebrilliant.com.  It is very important that you know what the final domain of your website will be for this step.


Enter the following one at a time to the "Accept requests from these "HTTP referrers (web sites)" field. Press DONE after typing in each domain to add it to the list:


  • *.directoryup.com - this is needed if your site is NOT live yet.

  • *.managemydirectory.com - Important: It is needed in order for your admin pages to work with the maps.

  • managemydirectory.com - Important: It is needed in order for your admin pages to work with the maps.

  • *.ilovebrilliant.com  (IMPORTANT: Replace "ilovebrilliant.com" with the final domain that YOUR website will be hosted on)
  • ilovebrilliant.com  (IMPORTANT: Replace "ilovebrilliant.com" with the final domain that YOUR website will be hosted on)



After you have completed the above, you should see the following:





(REMEMBER: You will not see "ilovebrilliant.com" in the list.  You will see the final domain of YOUR website in the list instead)




Step 7

Select the option "Don't restrict key" and then click on "Save":





Step 8

Next it is necesary to enable 3 APIs and services, click on: APIs & Services:



+ENABLE APIS AND SERVICES



The three main APIs that need to be active are:

  • PLACES:


  • GEOCODING:


  • MAPS JAVASCRIPT:



API Usage


Front EndAPI
Member ProfileMaps Javascript
Detect Visitor Location Add-OnGeocoding
Location SearchesPlaces and Geocoding
Google Search Assist Add-OnGoogle Custom Search (free)




Member Dashboard
API
Contact Details Form
Maps, Places and Geocoding
Post Form
Maps, Places and Geocoding
Multi-Location Add-OnMaps, Places and Geocoding




Admin DashboardAPI
"Enable All Location Features For "Pretty URL" Search Results Pages" Advanced Setting
Geocoding
Geocode Members
Geocoding
Location Searches
Places and Geocoding




Step 9

Click Save Changes!


Your Google Maps Javascript API Key is now set up and secured!


NOTE: If after completing this setup succesfully, the Google Maps search by location shows an error message, follow these articles for troubleshooting: