The code is described at the bottom of the documentation, almost as an afterthought. However, there is a complete description of the ClientLocation object that contains the data and an example.
If you're worried about sharing your location, privacy should not be more of a concern than usual. Google's service, like those mentioned in the earlier post, uses your computer's IP address. The series of four numbers (like 18.104.22.168) is publicly available and usually can only pin-point you at city-level accuracy.
That said, as with other geolocation services there's certainly some funny stuff possible, but I'm sure you'll use it for good, right? Right?
Hat tip: Brian Cray