Hello community, I would like to display my content sorted according to the visitor's country. I have been doing some research and I could use the ip of the user and work with a third party service like 'ipstack' to get the country but I wonder if there is a free way to do it just with hubspot?
the content I want to display is displayed by a module and consumed from hubdb.
Hello @llopez1 , HubSpot does some geolocation out of the box, in the docs you can find the HTTP Request Vriables that documents all kinds of variables that are tied to the request, thus you can use either the {{ request.geoip_country }} or the documented {{ request.headers.cf-ipcountry }} to check on the Country Code that came with the IP.
If you need further help don't hesitate to write here. Cheers!
If my answer was helpful please mark it as a solution.
Hey, @Kvis1. Thanks for your comment. It looks like the available variables have been updated, and no longer include the two mentioned by @miljkovicmisa. I'm going to add this to my archive list since it is outdated.
You are welcome to create a new post if you still need help, and we'll do our best to get some of our community experts to take a look.
1) Smart content modules display different versions of your content based on viewer category.
You can base your smart rules on the country. The country is determined by the IP address of the visitor.
2) On a Contact record there is a field 'IP Country', which automatically fills in a Country.
Consider using {{contact.ip_country}} in your templates. Then add conditional logic as you please.
Martin Angeletti
HubSpot Veteran (12+ years)
❌ Worried about messing up your HubSpot? I've got your back.
✅ Join the thousands of people who have discovered how to avoid problems with simple tricks and have started to dominate HubSpot (and not be dominated).
⛅️ Don't get left behind.
→ Click the subscribe button and scroll down to find the opt-in box.
Hello @llopez1 , HubSpot does some geolocation out of the box, in the docs you can find the HTTP Request Vriables that documents all kinds of variables that are tied to the request, thus you can use either the {{ request.geoip_country }} or the documented {{ request.headers.cf-ipcountry }} to check on the Country Code that came with the IP.
If you need further help don't hesitate to write here. Cheers!
If my answer was helpful please mark it as a solution.