CMS Development

llopez1
Member

get user geolocation

SOLVE

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.

0 Upvotes
1 Accepted solution
miljkovicmisa
Solution
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

get user geolocation

SOLVE

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.

View solution in original post

2 Replies 2
mangelet
Guide | Platinum Partner
Guide | Platinum Partner

get user geolocation

SOLVE

@llopez1 

 

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.

Subscribe

Did I help answer your question? Mark this as a solution.

miljkovicmisa
Solution
Top Contributor | Platinum Partner
Top Contributor | Platinum Partner

get user geolocation

SOLVE

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.