Learn how to implement an IP to location provider.
The localization information is displayed under the Location tab in the Analytics section of the Umbraco Engage dashboard.
Umbraco Engage Analytics natively supports storing and reporting localization information for incoming traffic. Localization refers to identifying the (physical) origin of an incoming request. Web requests from a visitor's browser do not contain location information. This means that you must implement this.
Most localization services, such as Maxmind, use IP addresses to perform a (rough) lookup. The information is compiled into a database where lookups can be performed. IP addresses do not contain any information regarding their (physical) origin, rather they only identify a device on the internet. Localization information for any given IP address is tracked manually and can change over time. We recommend either using an external service or acquiring a copy of a GeoIP database for localization lookup purposes.
Once you have a service that can provide localization information, you must integrate it with Umbraco Engage.
Implement the following interface:
Umbraco.Engage.Business.Analytics.Processing.Extractors.IRawPageviewLocationExtractor
This interface allows information about localization for a pageview, defined as a single visitor's visit to a specific point in time. The page view contains the IpAddress
property that can be used for Geo IP lookup.
Define a class that implements ILocation
This will hold the localization information that will be returned through the interface in our implementation.
Implement the location extractor to read and validate the incoming IP address and filter out local IP addresses with the native IsLoopback
method.
Call your Geo IP localization implementation.
Let the IoC container know to use your implementation for the IRawPageviewLocationExtractor
.
Umbraco Engage has a default implementation of this service, which only returns null. This default service is registered using Umbraco's RegisterUnique
method.
Override this service by calling RegisterUnique
after the UmbracoEngageApplicationComposer
.
After implementing this, Umbraco Engage collects and displays localization information for pageviews. This can be viewed in the Analytics section of the Umbraco Engage dashboard.
If the custom implementation returns null
, ILocation
will display as "Unknown".
The LocationExtractor only processes new pageviews and will not apply retroactively to historical data.
If the pageviews contain location information, the table with countries is displayed:
From the country, you can drill down to the city. This will then filter the displayed graph and table data to only display session and pageview information for the selected country. Even though Umbraco Engage does support the storage for county and province, the UI only supports displaying data by country and city.