1

So I am having an issue with my Geolocation on my CD server, it only comes back with US regardless if trying it from India, Australia or anywhere. CM comes back with the correct country code. I have read through the ticket from 2018 and tried to do everything on that thread as well as I have updated what the sitecore docs have:

  • Analytics.PerformLookup = true
  • subscribed to the service we are using
  • Sucuri as our firewall and load balancer, I allowed both of the service urls geoIp-ces.cloud.sitecore.net and Discovery-ces.cloud.sitecore.net on sucuri. We have an app gateway on azure that I havent set up anything for.
  • Analytics.ForwardedRequestHttpHeader = X-Forwarded-For

Is there anything else that is not setup correctly that I am missing or where I can find more settings that need updated? Like I said seems like the service is running since I get "US" back for everything but that is the broken part as well. Thank you for the help.

2
  • Do you have any CDN configured for CD server like azure front door, Akamai etc. ?
    – Arpit
    Feb 4, 2022 at 4:29
  • No just Sucuri and the app appgateway on azure. Feb 4, 2022 at 15:10

2 Answers 2

1

Enable Sitecore Geolocation Service API: First, you need to raise a request to Sitecore to activate the Sitecore IP Geolocation service. For the same, you can refer to Sitecore Documents. See the document: Set up Sitecore IP Geolocation

Now you need to make sure that XB and Analytics tracker is working fine in your environment.

Get the IP address from the Current Tracker as mentioned below:

if (Tracker.IsActive == false)
 {
    Tracker.StartTracking();
 }
return (Tracker.Current?.Interaction?.Ip != null) ?
    new IPAddress(Tracker.Current.Interaction.Ip).ToString() : string.Empty;

Once you will find the IP address of the user you can fetch the other details of the user. Sitecore provides below methods for this purpose:

  1. Sitecore.Analytics.Lookups.LookupManager.GetInformationByIp(…)
  2. Sitecore.CES.GeoIp.Core.Lookups.LookupManager.GetWhoIsInformationByIp(...)
  3. Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetRequiredService<Sitecore.CES.GeoIp.Core.IGeoIpManager>().GetGeoIpData(...)

See blog post for more details: Sitecore Geolocation Service API

0

So I tracked the issue done to our Application gateway and that is the IP getting passed to the service. The answers above helped a lot with tracking this down so I appreciate the help.

If anyone has any experience with this issue of allowing the IP through please reach out, thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.