IP Lookup Function

SHANE EBERT asked on July 18, 2017 22:45

From what I am aware, software like Marketo and Hubspot can tell you who has been on your site without someone filling out a form. Does Kentico have this ability?

Thanks

Recent Answers


Zachary Perry answered on July 18, 2017 23:09

Contacts in the Online marketing module will log IP address of visitors if that setting is enabled.

1 votesVote for this answer Mark as a Correct answer

Peter M answered on July 19, 2017 16:25 (last edited on July 19, 2017 16:42)

You can do it pretty much yourself without marketing. You have API for that:

GeoLocation currentGeoLocation = GeoIPHelper.GetCurrentGeoLocation();
if (currentGeoLocation != null)
{
    var countryAndState = ValidationHelper.GetString(currentGeoLocation.CountryName, "");
    var ipCountryCode = ValidationHelper.GetString(currentGeoLocation.CountryCode, "");
    var ipRegion = ValidationHelper.GetString(currentGeoLocation.RegionName, "");
    var ipCity = ValidationHelper.GetString(currentGeoLocation.City, "");
}    

Or using K# macros:

{% AnalyticsContext.CurrentGeoLocation.Country.CountryName%}
{% AnalyticsContext.CurrentGeoLocation.State%}
{% AnalyticsContext.CurrentGeoLocation.City%}
{% AnalyticsContext.CurrentGeoLocation.Postalcode%}

The database comes from MaxMind. You can learn more about managing it here

1 votesVote for this answer Mark as a Correct answer

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