How to Activate Google Nearby Results API
Introduction
This article provides a comprehensive, step-by-step guide on how to configure the Google Nearby Results API for your eDirectory website. Integrating this essential API ensures that your users see listings geographically relevant to their current location directly on the search results page, significantly improving their local search experience. Follow these instructions carefully to enable this functionality.
Instructions for Configuring the Nearby Results API:
- Creating a Project on the Google Cloud Platform API Console:
- 1.1. While logged into your Google Account, navigate to the Google Cloud Platform's API Console: https://console.cloud.google.com/apis/dashboard
- 1.2. Click on the "Select a project" dropdown at the top and then select "New project."
- 1.3. In the "New project" dialog, enter the following information:
- Project name: Type a descriptive name for your project, ideally related to your website (e.g., "My eDirectory Website").
- Organization: If you have a Google Cloud Organization set up, select it from the dropdown. Otherwise, this field may be optional.
- Location: Choose the Google Cloud project location that is geographically closest to you or your primary user base.
- Once you have filled in the required information, click on the "Create" button.
- Activating the Geocoding and Maps JavaScript APIs:
- 2.1. After your project is created, click on the menu button (three horizontal lines) in the top-left corner. Navigate to "APIs & Services" and then click on "Library."
- 2.2. On the API Library page, either scroll down or use the search bar to find the "Maps" category and click on it.
- 2.3. Within the "Maps" category, locate and click on both "Geocoding API" and "Maps JavaScript API." You can also use the search bar at the top of the Library page to find them directly.
- 2.4. On the individual pages for both the "Geocoding API" and the "Maps JavaScript API," click the "Enable" button.
Note: After clicking "Enable" for either API, Google will likely prompt you to link your project to a billing account. This is a mandatory step for displaying maps and utilizing location-based services on your eDirectory website. Please follow the on-screen instructions to configure your billing information after enabling the APIs. Google's policy requires a linked billing account for API usage, and maps will not be displayed without it. For more detailed information on Google Maps Platform billing, please refer to this official Google article: https://developers.google.com/maps/billing-and-pricing/billing
- Creating the Nearby Results API Key:
- 3.1. Click on the menu button again, navigate to "APIs & Services," and then select "Enabled APIs & services."
- 3.2. On the "Enabled APIs & services" page, click on "Credentials" in the left-hand menu. Then, click on "Create credentials" at the top and select "API key" from the dropdown.
- 3.3. In the pop-up window displaying your newly created API key, click on "Edit API key" to configure its restrictions.
- 3.4. On the API key configuration page, fill in the following required information:
- 1. Name: You can give your API key a descriptive name, such as "Nearby Results API Key."
- 2. Application restrictions: Select the option "IP addresses (web servers, cron jobs, etc.)"
Important Note for Shared Hosting Users: If your website is hosted on one of our shared servers, please insert the following IP addresses exactly as listed:
52.52.23.74
52.9.39.107
54.233.157.59
Important Note for Self-Hosted or Dedicated Server Users: If your website is self-hosted or on a dedicated server and you are unsure of your server's IP address(es), please contact our support team at support@edirectory.com for assistance in identifying the correct IP addresses to add here.
- 3. API restrictions: Enable the "Restrict key" option. Then, from the list of available APIs, select both "Geocoding API" and "Maps JavaScript API" (the same APIs you enabled in step 2.4). After selecting both, click the "Save" button at the bottom of the page.
- 3.5. You will be redirected back to the "Credentials" page. Locate the API key you just created. To view and copy the key code, click on the "Show key" link (eye icon). A pop-up window will display your API key. Click the copy icon next to the key to copy it to your clipboard.
- Integrating the Nearby Results API Key into eDirectory:
- 4.1. In your eDirectory Site Manager, navigate to Settings → Language & Geography → Visitor Location Detection & Nearby Results.
- 4.2. In the "Google Api Key (Server Key)" field, paste the API key that you copied in step 3.5.
- 4.3. Click on the "Save changes" button.
Note: Please note that the API key required for the Google Maps integration (used for displaying the map itself) and the API key (Server Key) for the Nearby Results functionality are not the same. They serve different purposes and require distinct configurations within the Google Cloud Platform. The Google Maps JavaScript API key is primarily used for rendering maps on your website's front-end, while the Nearby Results API key (Server Key), configured with IP restrictions, is used for securely accessing and retrieving location data for nearby listings.
Once the Nearby Results API is successfully set up, your website users will be able to filter search results based on distance from their current location, providing them with valuable information about the proximity of listings.
Linking Your Nearby Results API Project to a Billing Account:
As mentioned in step 2, displaying Nearby Results on your eDirectory website necessitates more than just obtaining an API key. To ensure its proper and uninterrupted functionality, billing must be enabled for the Google Cloud Platform project associated with your Nearby Results API key. Please follow the steps outlined in this guide to activate billing for your project: How to enable Billing for Google Maps and Nearby Results. This step is crucial for a seamless and fully operational integration.
Conclusion
By diligently following this comprehensive, step-by-step guide, you can successfully configure the Google Nearby Results API for your eDirectory website. This integration will significantly enhance the user experience by allowing visitors to easily discover listings located near them, making their search process more efficient and relevant.
Remember to ensure that all the required APIs (Geocoding and Maps JavaScript) are enabled in your Google Cloud Platform project, that a billing account is properly linked to your project, and that you have correctly integrated the API key (Server Key) into your eDirectory Site Manager. If you encounter any issues during the configuration process, double-check each step, confirm that billing is active, and review the IP address restrictions you have set for your API key.
For further assistance, our dedicated support team is always available at [email address removed]. With the Nearby Results API properly configured, your website will offer a more dynamic, location-aware, and ultimately more user-friendly experience for everyone.