← Back to Code Samples

Google Maps and the Directions API

Published November 13, 2019

eCommerce has exploded in the last decade, and companies need to lean into it our get out of the way. Party Rental Ltd., a party rental company that rents things like tables, chairs, and linens, leaned into it heavily. Not only were they the first in the industry to allow orders completely online, but they incorporated a popular “next stop notification” feature.

This next stop notification allowed customers to sign up for emails or text messages that would alert them when they were scheduled next for a pick up or drop off. The alert would contain a link to a page with details about their pick up / drop off but, most notably, it would contain a map with two points. One point would be the destination location, and another would indicate where the truck was last recorded (the location is supposed to update every 5 minutes or so).

Although the live version of this page did not contain the route information (i.e. how to get from point A to point B) for various business reasons, they always hoped to add it in eventually — and why not? So I took the liberty of including it in this code sample.

Note: if there is an issue running the pen, you can find the CodePen here.