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
2 Accepted solutions
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

lstepany
Solution
Contributor | Elite Partner
Contributor | Elite Partner

get user geolocation

SOLVE

{{ request.country }} this worked for my

View solution in original post

0 Upvotes
5 Replies 5
Kvis1
Participant

get user geolocation

SOLVE

I do not see these variables. Is this another outdated solution?

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

get user geolocation

SOLVE

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. 

 

Best,

Jaycee 

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
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.

lstepany
Solution
Contributor | Elite Partner
Contributor | Elite Partner

get user geolocation

SOLVE

{{ request.country }} this worked for my

0 Upvotes