如何獲取 Google 地圖 API 密鑰

有關如何獲取 API 密鑰的完整教程,請參閱此處的 Google 官方文檔: https://developers.google.com/maps/documentation/javascript/get-api-key

創建 Google API 密鑰

在你的, 谷歌云平台 導航至 API 和服務以查找您的憑證。單擊“創建憑據”按鈕後可以創建新的 API 密鑰,該選擇為您提供“API 密鑰”選項。

我們強烈建議您注意限制。您應該使用 HTTP Referrers 限制您的 API 密鑰 僅有的 對於將使用 Google 地圖 API 密鑰的網站。這樣一來,其他人就無法竊取和使用您的 API 密鑰。

啟用庫

我需要哪些 API?

由於 Google 沒有明確說明您需要激活哪些 API,因此以下是所有 Google 地圖功能所需的 API 列表:

  • 谷歌地圖路線
  • 谷歌地圖距離矩陣
  • 谷歌地圖海拔
  • 谷歌地圖地理編碼
  • 谷歌地圖 JavaScript

您必須在“庫”部分啟用這些 API。

將 API 密鑰保存在 Citadela Listing 插件中

在哪裡插入我的 API 密鑰?如果您以管理員身份登錄 WordPress,則可以在 Citadela Listing -> 集成中插入 API 密鑰

Debugging issues

If you encounter any issues with your Google Maps API key, you can easily debug them using the Console in your browser. To open the Console, simply right-click anywhere on the webpage, select “Inspect” or “Inspect Element,” then navigate to the “Console” tab. Here, you’ll find error messages and warnings that can help identify and resolve any issues with your API key configuration. Keep an eye out for any error messages related to the Google Maps API, and use them as clues to troubleshoot and fix the problem.