How to detect IP country to show relevant Menu

Hello! We’ve recently built two menus on our HubSpot CMS - one for the UK and one for US.
How do I get it to detect the IP country so that the right menu is shown for that visitor?

Hey @Kirsten8686

I have not done it before but i believe this can be done by enabling the custom content option in a module.

You can get ip country using

{{request.headers|attr('cf-ipcountry')}}


Barry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

Something to be aware of when using request.headers is that it disables page caching which could negatively impact your website/page performance.

If you’re using a global module, you could do what @Kevin-C suggested and use smart content in that module to display different content based on different locations.