Editor's note: To support companies and developers addressing changing consumer and business needs, we’re sharing our best practices for adding new functionality to your apps and websites.
With many restaurants and stores around the world unable to open for business as usual, a common question we hear from customers is how they can quickly add delivery capabilities to their businesses. Many of the same APIs and SDKs we highlighted in last week’s “buy online, pick up in store” postcan be used to shift to offering delivery of goods rather than pick-up. Let’s take a look at how.
Minimize delivery errors
It’s important to make sure your packages get to the right place, and having accurate address information is essential for reducing returned packages due to delivery errors. The Autocomplete API provides a ‘type ahead’ address prediction service. And by integrating it into your checkout flow you can accelerate address entry, reduce checkout friction, and reduce delivery errors.
After an address is obtained from the Autocomplete API, you can also use the Geocoding API to determine the precise lat/lng position of the user’s delivery address (using Place_ID from Autocomplete). This can be used to display a map with a movable pin to confirm the delivery and drop-off locations. This provides quick visual feedback to the user, and by repositioning the pin, allows them to fine-tune the drop-off location. You can again use the Geocoding API to convert the map pin location back to a human-readable address.
For locations that don’t have accurate or official addresses, you can now use Plus Codes from the Place Autocomplete and Geocoding APIs to obtain accurate delivery locations for your drivers.
Dispatch the best delivery driver
Manage a fleet of delivery drivers? Google Maps Platform can be used to improve your operations and help you operate more efficiently with access to real-time traffic information.
Use Distance Matrix API to compare the travel time from each possible warehouse or depot location to fulfill the order, allowing for the quickest possible delivery. Use the traffic_model parameter to access predictive travel times which anticipate how long the journey will take at the time the shipment needs to leave the depot.
The Distance Matrix API also utilizes live traffic information, allowing you to choose the closest driver by real-time journey duration to complete the pickup and delivery. This ensures the fastest possible order turnaround and a more efficient operation overall. With shorter drive times, drivers can deliver more orders each per day.
Have poor GPS data? The Roads API can be used to snap raw device locations from drivers onto the most likely position on Google’s road network. These adjusted positions can be used as the origin for Directions API or Distance Matrix API. Correcting the driver position in this way will result in more accurate directions and ETAs, improving overall efficiency and increasing capacity to handle orders.
Optimize your driver’s route
After you’ve selected your drivers, get them to their drop-off locations quickly. UseDirections API to provide turn-by-turn directions with real-time traffic for your delivery driver or to predict the duration of future sections of their route using the traffic_model parameter. This service will also optimize the order of waypoints for delivery, so that deliveries are completed in the shortest overall distance. Here’s a useful tip–set the destination using the Place ID from Place Autocomplete or Geocoding API (as opposed to the text address). This will route the driver to the best access point for the destination which will allow for a more efficient delivery in most cases, making your operation more efficient overall.
Use StreetView in a native app built with the Google Maps Android or iOS SDKs to display images of the drop off location to the driver, so he or she knows exactly where to stop and what the entrance looks like before they arrive, saving time at the drop off. Be sure to trigger out to the native Google Maps app to provide real-time turn-by-turn navigation with voice guidance.
Update your customer on the ETA of their delivery in real time
Protect location privacy
If you use users’ location data, please make sure to check and comply with the end user location privacy terms in the Google Maps Platform Terms of Service.
Next up, we’ll give you an overview of how restaurants can use Google Maps Platform and other Google resources to pivot to online delivery. For additional tutorials and technical info, check out our Google Maps Platform documentation. To learn more about Google Maps Platform, visit our website.