Detect Location geolocation

Nadia Tahir asked on May 10, 2018 15:56

hello kentico team i am trying to detect the current location is there any method in kentico to use it and get the city name i try some this code but didnt work any one have idea thanks

 {%if(AnalyticsContext.CurrentGeoLocation.City  != null) {%}
              your food in  {% AnalyticsContext.CurrentGeoLocation.City %}

          {% } #%}
              {% else{ %}
              there is no food in this location
             {% } #%}

Recent Answers


Peter Mogilnitski answered on May 10, 2018 16:12

hope, you are not doing it on your local server? It wont work for internal network IPs. Print your {%IP%} and google 'IP Location Finder' and see how your IP is resolved there.

0 votesVote for this answer Mark as a Correct answer

Nadia Tahir answered on May 10, 2018 16:26

i am doing it in trasnformation what is the best practices to do it

0 votesVote for this answer Mark as a Correct answer

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