Before you start
You need a Google account and a company payment card for entering the billing details. The button names in this guide are the English ones that Google's Cloud service shows.
Create the API key in the Google Cloud console
- Open the Google Cloud Platform Console (console.cloud.google.com) and sign in with your Google account.
- Select an existing project from the menu at the top or create a new one by selecting New Project, name the project and click Create.
- Select Maps APIs and Services and click Maps Javascript API.
- Click Enable.
- Go to APIs & Services → Credentials.
- Click Create Credentials and select API key. Google creates the key; copy it and keep it safe.
Restrict the key to your shop's address
- Click Restrict Key.
- Under Application Restrictions, select HTTP referrers.
- Add the allowed addresses with the Add an item button:
- If you use Johku's default address: https://[shop ID].johku.com/*
- If you use your own domain: https://*.sivustonnimi.fi/* and https://sivustonnimi.fi/*, where sivustonnimi.fi is your own domain name without www. This way the map works both on the main domain and on all subdomains.
- Under API Restrictions, leave the default choice Don't restrict key.
- Save the changes.
Set the billing details in Google Cloud
- Select Billing from the menu.
- Click Link a billing account and then Create Billing Account.
- Check the country and account details, accept the terms and click Continue.
- Enter the company details and the payment card details.
- Finally, click Start my free trial.
Set the key in Johku
- In the Johku admin, open Settings → Storefront → Other.
- Paste the key into the Google Maps API key field under Domain settings.
- Save.
Result
When the product also has location details and cookie management is enabled in the shop, the Google map is shown on the product page to visitors who accept marketing and statistics cookies. Once the key has been set, the OpenStreetMap map isn't shown, so other visitors don't see a map on the product page. The full picture is described in Add a location and map to a product.
If the map doesn't work after you set the key
The map doesn't load or shows an error. Check that Maps Javascript API is turned on (Enable), that the billing details have been entered and that the allowed addresses include exactly the address where your shop appears. A change to the address restrictions may take effect after a short delay.