Menu

A Google Place ID finder in 10 lines of JS
📰

A Google Place ID finder in 10 lines of JS

DEV Community: tutorial·Axarez·2 days ago
#Lwt6JqQD
#devtotutorial#devto#dev#google#place
Reading 0:00
15s threshold

The problem

A local business owner asked me: "How do I send customers a link that opens the Google review box straight away?"

Google supports this with a direct review link:

https://search.google.com/local/writereview?placeid=ChIJb5qX9LW9cEgRVzYV0mRGxVw

Enter fullscreen mode

Exit fullscreen mode

To build it you need the business's Place ID (the ChIJ… string). The official route is the Places API, which means:

a Google Cloud project

an API key and billing details

a server to keep the key private

There's a simpler way. The Place ID is already inside every Google Maps link , just encoded differently. In this post we'll build a Place ID finder around one small function (about 10 lines) that pulls it out, entirely in the browser.

TL;DR

Step What you do

1 Find the feature ID in the Maps URL: !1s0x…:0x…

2 Pack its two 64-bit numbers into 20 bytes of protobuf

3 Base64url-encode the bytes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.