If you’re going to be using shared/public Wi-Fi, I first recommend that you make sure that your Mac’s firewall is enabled. Go to System Preferences, then Security and Privacy to check this.
In addition to using your Mac’s firewall, you may want to consider using a VPN or the Tor Browser. Both will encrypt your network traffic to a remote location, where the traffic is then sent to its destination, preventing snoopers on your local network from seeing what sites you visit or harvesting personal information. The main difference is that while a VPN is faster than Tor, it only sends it to one location, where it gets decrypted; the VPN provider could log what sites you visit. Tor, on the other hand, encrypts your traffic and bounces it to at least two random locations before decrypting it at yet another random location and sending it to its destination. This makes it truly impossible for snoopers on your network to know what sites you are visiting, and the website’s servers have no idea what your real IP address (and your location) is.
In addition, you’ll want to use HTTPS wherever possible. This ensures that an additional layer of encryption remains that only the website can remove. Otherwise, if you’re visiting a site whose address does not begin with https, snoopers at the end point of the VPN provider or the Tor exit node can intercept all of the data (except your IP address) that you’re sending to that site.
Tor Browser can be downloaded here:
Hope this helps!