# Connect Google Maps Platform for prospects and trips

Connecting your own Google Maps Platform API key lets PiGi search Google's business listings when you look for prospects to sell for you, and plan marketing trips along real roads. Usage is billed to your own Google Cloud billing account; without a key, both features still work in a weaker form.

Source: https://help.pigi.io/guides/integrations/marketing-and-sales/google-maps

## Quick answers

**What does the Google Maps integration do in PiGi?**
Two things. On **Marketing → Prospects → Find prospects**, PiGi searches Google's business
listings for hotels, backpackers, activity desks and other businesses near you, instead
of searching the web. On **Marketing → Trips → Plan a trip**, it orders your stops and
draws the route along real roads with real drive times.

**Do I need Google Maps for addresses and maps elsewhere in PiGi?**
No. Address search and maps elsewhere in PiGi work without this integration. It only
affects prospect research and trip planning.

**Who pays for the Google usage?**
You do. Requests are billed to the billing account on your own Google Cloud project, at
Google's Maps Platform prices. PiGi never uses its own key as a fallback for these
searches.

**Which Google APIs do I need to enable?**
**Places API (New)** for prospect research, and **Routes API** for trip planning. A key
with only Places enabled still works for prospects; trip plans then fall back to
estimates.

**Can I restrict the key to my website?**
No. A key restricted to website referrers cannot work, because PiGi calls Google from
its servers. Restrict it by API instead (Places API (New) and Routes API).

**What happens without a key?**
Prospect research falls back to a web search, which finds far fewer businesses. Trip
plans use straight-line distances and say "Google Maps is not connected for this
company".

## What this does

Google Maps Platform is Google's paid mapping service. Connecting your own key gives
PiGi's marketing tools Google's business listings and road routing. Google requires a
billing account on the project and charges per request, with monthly free usage on each
API; see Google's Maps Platform pricing for current figures. Prospect searches send many
requests, so set a budget alert in Google Cloud.

## Before you start

- The **admin** role in PiGi.
- A Google account that can create a Google Cloud project and add a billing account.

## Set up Google Maps Platform

1. In the Google Cloud console, create a project and link a billing account to it.
2. Go to **APIs & Services → Library**. Enable **Places API (New)** and, for trip
   planning, **Routes API**.
3. Go to **APIs & Services → Credentials**, click **Create credentials → API key**.
4. Open the new key. Under **API restrictions**, choose **Restrict key**, select **Places
   API (New)** and **Routes API**, and click **Save**.
5. Leave **Application restrictions** off **Websites**. If you want an IP restriction,
   ask PiGi support for the addresses to allow.
6. Copy the key.

## Connect it to PiGi

1. Open **Settings → Communication → Integrations** and click the **Google Maps
   Platform** tile, then **Connect Google Maps Platform**.
2. Click **Add credentials**, paste the key into **API key** and press **Save**.
3. Click **Test connection**. PiGi makes the cheapest possible Places search to prove the
   key works.

## Test it

1. Open **Marketing → Prospects → Find prospects**, pick a category and run a search near
   your site. Results should include Google Maps links for each business.
2. Open **Marketing → Trips → Plan a trip** with a few stops. The route should follow
   roads, with no note about straight-line estimates.

## Troubleshooting

- **"No API key saved. Create one in your Google Cloud console with the Places API
  enabled."** Add the key under **Add credentials**.
- **"… — check the key was copied in full."** The key is wrong or incomplete.
- **"… — this key is restricted to website referrers, which cannot work from a
  server."** Change **Application restrictions** in Google Cloud.
- **"… — most often the Places API (New) is not enabled on the Google Cloud project, or
  the key's API restrictions exclude it."** Enable Places API (New) and include it in
  the key's API restrictions.
- **"… — Google is rate-limiting or the project has no billing account."** Link a billing
  account, or wait and try again.
- **Trip plan says "Google Maps could not plan this route (…)".** Usually the Routes API
  is not enabled, or the key's API restrictions leave it out.

## Known limitations

- Prospect research also needs PiGi's AI assistant to be available; Google Maps alone
  does not run it.
- The **Find prospects** page does not show whether a search will use Google's listings
  or the web.
- Costs build up quickly on large prospect searches; PiGi does not cap your Google
  spend.

## Sources

- [Google Maps Platform: Get started](https://developers.google.com/maps/get-started)
- [Places API (New): Set up your Google Cloud project](https://developers.google.com/maps/documentation/places/web-service/cloud-setup)
- [Places API (New): Use API keys](https://developers.google.com/maps/documentation/places/web-service/get-api-key)
- [Google Cloud: Manage API keys](https://docs.cloud.google.com/docs/authentication/api-keys)
