Wednesday, October 28, 2015

Multiple versions of an Item for a Language in Web database possible with Sitecore 8.1


In earlier versions of Sitecore (i.e.  Sitecore 8.0 or ealier), WEB database could only contain single item for a given language of an item.

In the hangout session done by Sitecore for Sitecore 8.1 release, I heard that it is possible to have more than one version of an item from given language in WEB database.


But, this is not possible to all the items. To allow multiple items be published to web database, an item must satisfy (or should contain) certain conditions.

One situation that allows multiple item versions for given language item is, item should have an Active Test running for different versions of the same language of that item




When the test successfully ends, Sitecore automatically creates a new version with the matching winning item version and published to Web database





NOTE: Web database will be only containing single item after the Test ends


So, next time when you teach Sitecore to a junior developer, remember NOT to say "Web database contain only one item version for a given language" :-D

Monday, October 19, 2015

rootPath and startItem attribute usege in Sites configuration in Sitecore

Recently, one of my colleagues asked me a question which questioned my knowledged in Sites configuration attributes in Sitecore web.config file

Question:

We have a content tree as follows




When a user visits the http://scfootsteps.local/ , user will be presented with the /sitecore/content/home item, which is the combination of rootPath + startItem in the <sites> configuration

<site name="website" rootPath="/sitecore/content" startItem="/home" ... />


But, what happens if user visits http://scfootsteps.local/aboutus url ?

Answer :

Before degging deeper into this, first refresh our minds with definitions of rootPath & startItem attributes in <sites> configuration

rootPath
The path to the root item of the site in terms of Sitecore content tree. For example, it is set to /sitecore/content for the “website” site.

Quote : https://sdn.sitecore.net/SDN5/Articles/Administration/Configuring%20Multiple%20Sites/Adding%20New%20Site/site%20Attribute%20Properties/rootPath.aspx
startItem
The path to the start Item of the site. This Item will be opened by default when the site is requested. All relative URL paths will be relative to the startItem.

Quote : https://sdn.sitecore.net/SDN5/Articles/Administration/Configuring%20Multiple%20Sites/Adding%20New%20Site/site%20Attribute%20Properties/startItem.aspx

So, that means, anything under the "rootPath" is accessible from typing url.


Question :

Then the next question is, what happens if there are two items with the same name as follows
1) /sitecore/content/aboutus
2) /sitecore/content/home/aboutus



Answer :

Answer is, if item with the same name exists in under both nodes, item inside the /home (i.e. startItem) will get priority






When we delete/remove the item inside the home node (i.e. "sitecore/content/home/aboutus"), item outside the /home node (i.e. "sitecore/content/aboutus" will be displayed for the same url (http://scfootsteps.local/aboutus)





In the next post, we will dig deep into code to see how this above mentioned functionality is handled by Sitecore

happy Sitecore Footsptes  :-)

Friday, October 9, 2015

My Experience on Sitecore IP Geolocation service

Recently we had a task of configuring Sitecore IP Geolocation service with our existing Sitecore website. Even though the configuration is straight forward with good documentation, we were NOT able to configure Personalization to work properly.

i.e.
When we try to add a personalization with GEO IP rules, it didn't detect the country/IP information fro IP Geolocation service
Some sample configurations can be found in the following document
https://doc.sitecore.net/sitecore%20experience%20platform/ip%20geolocation/getting%20started%20with%20sitecore%20ip%20geolocation%20service


INSTALLATION


Follow the installation steps in the following document
https://doc.sitecore.net/Sitecore%20Experience%20Platform/IP%20Geolocation/Setting%20up%20Sitecore%20IP%20Geolocation#_Install_and_enable

NOTE :
If you don't have a way to configure your firewall settings to allow requests to the service by domain names, then you need to allow all the IPs for Microsoft Azure Datacenter, defined in the following document

https://msdn.microsoft.com/en-us/library/azure/dn175718.aspx

That contains larger number of IPs and they can be changed time to time

TROUBLESHOOTING


If your IP is not getting resolved correctly (or your personalizations are not working correctly), then try to use the 'TestIp.aspx' file in the following kb.sitecore.net artible and try to see if your IP is correction detected by Sitecore IP Geolocation services.

https://kb.sitecore.net/articles/798498


NOTE:
This TestIp.aspx page directly contacts/users GeoIP service and get the necessary data for the requested IP.

That is not the case when this service used in Sitecore website

Quote from doc.sitecore.net
When IP information is requested, the following steps are performed:
  • Lookup of IP information in the memory cache;
  • Lookup of IP information in the database;
  • Request to the Geolocation service.

Quote from Sitecore Support
When IP is resolved, the Geo Data (Country, City, etc) corresponded to the IP is searched in cache and then analytics database. If these storage contain data even incorrect, the service won't be used at all.

So, if you are continuously receiving incorrect information, then it is good to do following steps

1) Check whether the correct IP information is stored in the Analytics database:
  • Sitecore 7.5 - Sitecore 8.x: the "GeoIps" collection, Collection database (MongoDB)
  • Sitecore 6.4.1 - Sitecore 7.2: the "GeoIps" table, Analytics database (SQL)
And if incorrect Geo location information stared for a given IP, deleted that incorrect IP info from the GeoIps table/collection and do an app pool reset (to clear application cache). 
Correct Geo information will be cached/stored again in the next request.

2) Use proxy client (like Hide My Ass) to change your IP and try with a new IP