When using personalization or conditional renderings with rules based on the geographical information of the visitor (such as where the country is equal to specific country), the personalized content might not been presented to the visitor correctly on the first request.
Such behavior occurs because Sitecore is designed not to wait until the GeoIP information has been resolved from a GeoIP lookup provider. This is implemented to keep response times for the website visitors low in situations when the GeoIP resolution process is taking a long time.
To make Sitecore wait for the GeoIP information even on the first request from a visitor, proceed as follows:
public class UpdateGeoIpData : CreateVisitProcessor
public override void Process(CreateVisitArgs args)
int intSetting = Settings.GetIntSetting("Analytics.PerformLookup.CreateVisitInterval", 5); // retrieve the delay value from the setting.
args.Interaction.UpdateGeoIpData(TimeSpan.FromSeconds((double) intSetting)); // wait for the time specified in the Analytics.PerformLookup.CreateVisitInterval setting.
The approach overrides the logic of the createVisit pipeline and makes Sitecore wait a certain period of time for the GeoIp information to be resolved. The delay time is configured using the Analytics.PerformLookup.CreateVisitInterval setting. The setting defines the maximum delay to resolve the geographical data from the lookup provider allowed during the first page-request of a new visit.