Updated: There is a follow-up to this post, which points out some extra issues with the way GeoIP configuration is currently documented for v8-era Sitecore setups that change the “
Analytics.PerformLookup” setting below. If this setting is of interested to you, please read that too!
I spent some time this week looking at a client site whose analytics data was missing GeoIP information. Since they had a valid license for Sitecore’s GeoIP lookup service, this was a bit confusing. So, continuing my battle to write up all the unexpected scenarios…
The client site I was asked to look at was running Sitecore 8.2, and they had used the App Center to set themselves up with a license for GeoIP lookups. Writing code that called the lookup manager directly seemed to be working – and returned valid data about the current user.
But when you looked at the analytics data visible in the Sitecore UI, none of the users had any location data associated with them.
After seeing this issue, I had a dig around looking for any clues about what was going on. What I noticed was that the raw data in MongoDB was missing for anything relating to GeoIP. The “GeoIPs” collection wasn’t present, and none of the records in the “Interactions” collection included the “GeoData” element.
It took some head-scratching, googling and config file diffing, but eventually I worked out what was up.
The client’s site was running one CM server and two CD servers, which shared the same core config files. Those config files included a change which set the “
Analytics.PerformLookup” setting to false.
Documentation (Can’t find it specifically for V8 – but it is covered for older versions) says that this setting should be “true” for precisely one server in any deployment – in order to protect against deadlocks, and to avoid chewing up your lookup allocation excessively. (Note that V9’s documentation says you can set it true on multiple servers – so that code has clearly changed a bit in more recent releases) Since this site had it set false everywhere, it looked like none of the machines in the cluster were actually performing the asynchronous lookup of IPs that xDB was recording.
I came across a blog post which suggested it should be your least loaded server that does these lookups – which makes a lot of sense. So I deployed a simple patch to the CM server to make that setting true again:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<setting name="Analytics.PerformLookup" set:value="true"/>
Once that was deployed, the missing MongoDB collection data appeared:
And the experience explorer started to show locations for new visits: