Location/Country of the user

Always Learning asked on February 4, 2019 21:03

We are using Kentico 8.2 webfarm.

I need to block certain content depending on the location of the request. Like a user from USA, Canada, and another North America country will see a different content block. Altogether there are 4 content block, where the 4th is default.

Please note that the user might not be logged in so need to identify the request.

If the user is using VPN or proxies then they will see that content.

Correct Answer

Peter Mogilnitski answered on February 4, 2019 23:17

It doesn't matter, behind the scene Kentico is using free MaxMind database (you can subscribe to the paying one), that maps user IP to location.

You can create a few static text web parts for your text blocks and put into visibility condition macro like this: {% AnalyticsContext.CurrentGeoLocation.Country.CountryTwoLetterCode == 'US'|(identity)GlobalAdministrator%} this web part will be visible only for Canda

0 votesVote for this answer Unmark Correct answer

Recent Answers


Eric Dugre answered on February 4, 2019 21:11

You can enable geolocation (https://docs.kentico.com/k82/on-line-marketing-features/contact-management/working-with-contacts/using-geolocation-for-contacts) then reference the contact's location in a personalization variant: https://docs.kentico.com/k82/on-line-marketing-features/content-personalization/setting-display-conditions-for-personalization-variants.

Note that the contact's location is only set on the first visit, so if you want to update it every time they access the site, you would need to do it manually using the geolocation API.

0 votesVote for this answer Mark as a Correct answer

Always Learning answered on February 4, 2019 21:19

Thanks @Eric Dugre.

  1. On the site the user will not be logged in
  2. Even when the first time the page shows, i need to know the location

For Contact-Management, does the user need to be logged in?

0 votesVote for this answer Mark as a Correct answer

Always Learning answered on February 5, 2019 15:18 (last edited on February 5, 2019 15:23)

Hi @Peter Mogilnitski, for the free lite version, do i need to specify the key in the config file like following?

<add key="CMSGeoIPLocationFileName" value="GeoIPCity.dat" />

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on February 6, 2019 18:52

Yep. Just follow the documentation

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.