Sitecore 8 : Geo IP Lookup Configuration Tips

Greetings Readers,

I have compiled few tips related to the Geo IP configuration with sitecore


Spoofing Geo IP for local Development

There are some really good posts out there which illustrates how to spoof geoIP for local development, Honestly I have felt that the chrome extension is by far the most stable and comprehensive plug-in for spoofing IP addresses

Sitecore Analytics Testing Tools Chrome Extension by Derek Hunziker

https://chrome.google.com/webstore/detail/sitecore-analytics-testin/pecalkbdlhhhcoenmcjnmhgnncnkdgak?hl=en-US

Blog post by John West

http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2011/05/spoof-an-ip-address-to-test-geoip-with-the-sitecore-customer-engagement-platform.aspx

Another one by Patrick Jones

http://patrickmjones.com/blog/2014/03/17/testing-geolocation-with-sitecore/


Enable Look ups on only one server in scaled environments

The Analytics.PerformLookup setting in the /App_Config/Include/Sitecore.Analytics.config file governs the lookup activity, and is true by default. In a scaled environment Disable GeoIP lookup on all the production (CD) servers by setting the below value in the Sitecore.Analytics.config file. The below setting should be set to TRUE on only one server (for example : least loaded server, as a rule – CM server)

If more than one server configured as true for this setting can cause SQL deadlocks and other problems, as well as using your queries to MaxMind.

more details : https://blog.horizontalintegration.com/2015/02/12/sitecore-analytics-exception-in-geoip-worker-thread/

<setting name="Analytics.PerformLookup" value="false" />

Disable GeoIp functionality completely

If you sitecore implementation is not using Geo IP functionality then you can safely disable the complete functionality by setting the below setting to false

<setting name="Analytics.PerformLookup" value="false" />

Also please make sure to disable the below config files

  • Website\App_Config\Include\CES\Sitecore.CES.config
  • Website\App_Config\Include\CES\Sitecore.CES.DeviceDetection.config
  • Website\App_Config\Include\CES\Sitecore.CES.GeoIp.config
  • Website\App_Config\Include\CES\Sitecore.CES.GeoIp.LegacyLocation.config

Change the Default Lookup Provider

In order to implement a custom lookup provider :

Create your custom provider class that is derived from the Sitecore.Analytics.Lookups.LookupProviderBase abstract class.

Disable standard GeoIp functionality in Sitecore by adding “.example” to the end of the following file names:

  • \App_Config\Include\CES\Sitecore.CES.GeoIp.config
  • \App_Config\Include\CES\Sitecore.CES.GeoIp.LegacyLocation.config

In the \App_Config\Include\Sitecore.Analytics.config file, configure the lookup provider to use your custom class:

<lookupManager defaultProvider="default">
  <providers>
    <clear/>
    <add name="default" type="YourClass, YourAssembly"/>
  </providers>
</lookupManager>

Troubleshooting Sitecore Lookup Provider

Below is a list of knowledge base articles which troubleshoots various issues with the lookup provider

Troubleshooting the MaxMind provider https://kb.sitecore.net/articles/606943

MaxMind lookups do not get updated :  https://kb.sitecore.net/articles/777948

Personalization with Geo-based conditions does not work properly on the first visitor request :  https://kb.sitecore.net/articles/320734

 

If you have questions , please comment or tweet me @sjain_hi

Advertisements

Troubleshooting Sitecore Index Errors : Index already exists

Greetings Reader,

In this post, I would like to address some of the commonly faced issues while setting up SOLR to work with Sitecore. This post specifically targets Sitecore 8,  but should be valid for some of the older versions

ERROR

An index with the name “sitecore_master_index” have already been added.

MasterIndex

REASON

The issue is that there is more than one index with the name “sitecore_master_index” being loaded on the sitecore application start.

SOLUTION

Scenario 1 : While using SOLR, all the lucene index files are not disabled properly

Please make in your App_Config/Include folder , that only one of the two files is enabled (depends upon if you are using lucene or solr) Sitecore.ContentSearch.Lucene.Index.Master.config or Sitecore.ContentSearch.Solr.Index.Master.config

Scenario 2 : Custom patched config files 

If you are using custom patched config files to add Index strategies  or add computed fields to existing indexes, please make sure that your patches are being applied in correct order.

if you are unsure about how patching works, this link can get you started

http://sitecore-community.github.io/docs/documentation/Sitecore%20Fundamentals/Patch%20Files/

Please comment below if you have questions or tweet me @sjain_hi

Fixing Path Analyzer Fatal Error : Cannot create instance using path

Greetings Readers,

While doing a routine maintenance check on a system which is running Sitecore 8.1 Update 2 ,  I would start seeing series of errors related to path analyzer. The details of the issues are below

12008 09:55:52 FATAL [Path Analyzer](ApplicationContainer.GetInstance) Can’t create instance using path ”. Make sure the referred element is present in configuration
12008 09:55:52 ERROR Exception when executing agent pathAnalyzer/newMapAgent
Exception: Sitecore.Exceptions.RequiredObjectIsNullException
Message: tree definition service
Source: Sitecore.PathAnalyzer
at Sitecore.PathAnalyzer.Processing.Agents.NewMapAgent.GetTreeDefinitions()
at Sitecore.PathAnalyzer.Processing.Agents.BuildMapAgent.Execute()
at Sitecore.Analytics.Core.BackgroundService.Run()

As such from the looks of it, it really does not explain in detail as to why the path analyzer instances are not being able register correctly.

Solution

The issue was that the Path Analyzer agent (newMapAgent) starts executing before the Path Analyzer instances are registered correctly.
The underlying issues was with order of processors which were firing in the Initialize pipeline , It may happen because order of the processors “initialize” pipeline is not correct.
To fix it, please modify the Sitecore.PathAnalyzer.config file:
replace this line:
<processor type="Sitecore.PathAnalyzer.Pipelines.Initialize.Loader, Sitecore.PathAnalyzer" />
with the following one:
<processor type="Sitecore.PathAnalyzer.Pipelines.Initialize.Loader, Sitecore.PathAnalyzer" patch:before="processor[@type='Sitecore.Pipelines.Loader.LoadHooks, Sitecore.Kernel']" />

Indeed this fix did work for me, Sitecore support also acknowledged that this issues is a defect in sitecore 8.1 Update 2 , please mention reference 99665 in the support ticket.

Please comment if you have further questions or tweet me @sjain_hi

Sitecore 8 Content Testing : Start A/B Multivariate Tests without Workflow

Greetings Readers,

In my previous blogpost , we saw how to add the ability to start A/B test in Experience Editor using workflow. Everything was good until a thought crossed my mind that even today many sitecore implementations and organisation that have Sitecore CMS do not use workflow. so my quest began to find out a solution which allows content editors to create test in experience editor on items that dot not have workflow implemented.

As shown in the below image   if you create a component test, here is what you see in the Experience Editor. As you can see that the notification area in the experience editor shows that the “The Item has a test in draft” . But there is not way for the content editor to start or create a test.

b2s1

 

In Sitecore 8.1 and above there is a hidden setting which can be turned on to allow the content authors to start test via experience editor. Please add the below settings either as  patch config file or you can edit the value in the config file called App_Config\Include\ContentTesting\Sitecore.ContentTesting.config and the setting name is “ContentTesting.AlwaysShowTestCandidateNotification

<?xml version="1.0"?>
<!-- Override Setting to Enable Starting Test using Experience Editor -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
         <setting name="ContentTesting.AlwaysShowTestCandidateNotification" value="true" />
    </settings>
  </sitecore>
</configuration>

Now when we open the same item in the experience editor, we see the below results. This is awesome and now the content editors can create test right inside the experience editors without workflow.

b2s2

Should you have any questions, Please comment below.

 

 

 

Sitecore 8 Content Testing : Start A/B Multivariate Tests using Workflow Commands

Greetings Readers,

I am going to write a quick blog post about starting A/B Test via workflow, In Sitecore CMS version 8.0 and up, Sitecore Content testing has changed quite a bit with array of new functionalities. Up until sitecore CMS version 7.2 you could create and start the test in page editor using a “START” button (See Image Below). But in version sitecore 8.0 you would not be able to do so from the Experience Editor. This post will go through the process of configuring the A/B test via workflow and hence allowing content editors to execute the test from experience editor.

ContentTesting

Create Workflow Command  : Start Multivariate Test

Create a Workflow Command named Start Multivariate Test using a command template (/sitecore/templates/System/Workflow/Command). This command will allow the user to create and start the tests on the selected item

On the newly created command , please fill in the “Appearance Evaluator Type” field with this value “Sitecore.ContentTesting.Workflows.TestCandidatesCommandStateEvaluator, Sitecore.ContentTesting”(See Below) . This value will allow sitecore to show /Hide this workflow steps based on multiple conditions such as Is Content Testing Enabled, Is Automatic Content Testing Enabled ,  Is the test already running, Is the test valid etc.

step2

Create Workflow Action: Launch Create Test Dialog

We will now create a action which will be executed as soon as the user executes the Start Multivariate Test command. Sitecore has a inbuilt wizard built in SPEAK for creating A/B test. Let us see how to configure that

create a action named “Launch Create Test Dialog” based of the a special template called “/sitecore/templates/System/Content Testing/Workflow/Launch Create Test Dialog Action

Type String : Sitecore.ContentTesting.Workflows.LaunchCreateTestDialogAction, Sitecore.ContentTesting

Also check the “Create Suggested Tests If No Wizard” which will create a suggested test if there are no test to be configured on the page by sitecore.

step1

This is all you need to start the multivariate test on a custom workflow. If you need to clean up existing test or remove unwanted tests form you page you can do it as follows

Create Workflow Action: Remove Test

In order to clean up or remove Tests, create a action named “Remove Test” based of the a special template called “ /sitecore/templates/System/Content Testing/Workflow/Remove Tests Action

Type String: Sitecore.ContentTesting.Workflows.RemoveTestsAction, Sitecore.ContentTesting

Check the Delete Test Definition checkbox

step3

Executing this step will cleanup all the test definition which are stored here /sitecore/system/Marketing Control Panel/Test Lab

 

That’s all for now, please comment if you have further questions on the same.

 

Build Sitecore SOLR indexes into a Single Core

Greetings Readers,

This post will focus on showing you a way to build sitecore SOLR Indexes into a single core, Before diving deep I would like to explain what is a SOLR Core

SOLR Core is a running instance of a Lucene index along with all the SOLR configuration required to use it. A single SOLR application can contain 0 or more cores which are run largely in isolation but can communicate with each other if necessary via the Core Container.

By default Sitecore instances ship with  14 different indexes such as “sitecore_master_index…” and you have the option to either use SOLR or Lucene for these indexes, If you plan to use SOLR you have on the 2 options below

  • Create 14 different cores in your SOLR instance to accommodate all the default 14 sitecore indexes
  • Create 1 core for all the 14 different indexes

Being a developer and for my developer instance option 2 sounds better and quicker, So lets get down to business and see how to make all the sitecore default indexes build on a single core

As you can see in the below patch file which I have created to specify the name of the core in solr where the index needs to build.

The below is a sample include file which will index all of the sitecore_suggested_test_index data into this core “ClientName_Solr_Core”, You can repeat the same process of changing the name of the other sitecore indexes in a same way by changing the name of the core parameter.

<?xml version="1.0" encoding="utf-8"?>
<!-- Purpose: This include file defines the indexes used by the content testing feature of Sitecore when using the SOLR content search provider. -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
        <indexes hint="list:AddIndex">
           <index id="sitecore_suggested_test_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
           <param desc="core">ClientName_Solr_Core</param>
          </index>
        </indexes>
      </configuration>
    </contentSearch>
  </sitecore>
</configuration>

The below line does the magic.

 <param desc="core">ClientName_Solr_Core</param>

I have also blogged about Install multiple instances of SOLR for Sitecore on a single server which can be used as an different option.

If you have further questions, comment or tweet me at @sjain_hi

Install multiple instances of SOLR for Sitecore on a single server

Greetings Readers,

Firstly, What is the use case of installing multiple instanced of SOLR on the same server ?
Use Case 1 : If you are developer working on multiple clients, you will need multiple instances of SOLR for each client
Use Case 2 : For clients, we can use a single physical box to house solr instances for various environments such as “Dev, Stage and QA”. This gives us in reducing costs and performance benefits on a dedicated SOLR physical server.

This post outlines the steps needed to run multiple instances of SOLR for Sitecore on a single server.Sitecore community bloggers have excellent posts on how to install SOLR and make it work with sitecore, so I will not repeat the steps to make SOLR work with Sitecore.

This post is specifically targeted for Solr 5.0.0 and above.  Up to version 5.0.0, it was possible to run Solr inside the Java web application container of your choice. However, since the release of version 5.0.0, the Solr team at Apache no longer releases the solr.war file. This file was necessary to run Solr from a different web application container such as Tomcat. Starting with version 5.0.0, Solr will be distributed only as a self-contained web application, using an embedded version of Jetty as a container.if you looking to run multiple instances of SOLR for versions before 5.0, Our friends have already done that here.

Things you will need to get started

  • SOLR 5.3.0 (You can also download earlier versions also starting 5.0.0)
  • NSSM (Light Weight Service Manager utility to create windows service)
  • Java 7 or Higher (If you already have java installed, ensure that your JAVA_HOME variable is set)

Create SOLR Directory

Let us start by creating Directories for the SOLR install

Create a directory which will house all the Solr files: C:/SOLR/Client1

Extract all the content of the SOLR Zip into the above created folder, the contents would look like this

Folder1

Create Service Manager Directory

The service manager application allows you create windows service using a GUI. Unzip the contents of the above NSSM downloads into a folder of your choice, I did it here C: /SOLR/NSSM

Folder

Install Solr and Start as Windows Service

Before we proceed, please ensure you have all of the below figured out

1.) Name of the Solr Service (for example : SOLRCLIENT1)
2.) Port of the Service (For example : 8983)

Open command prompt as admin and navigate to the service manager directory

nssm1

Issue Command: nssm install SOLRCLIENT1

This command will invoke a prompt asking you to fill the details of the service

nssm2

Fill out the path to the solr.cmd script, and the startup directory should be filled in automatically. Don’t forget to input the -f (foreground) parameter so that ServiceManager can kill it when it needs to be stopped or restarted.

Also the –p (Port) parameter allows you run solr on a specific port (This is very critical step because by changing the ports you can allow solr to run to different ports)

The following step is optional, but enables a clean and descriptive name in my Windows Service Manager. Under the details tab, fill out the Display name and Description.

nssm3

Click on Install Service and the SOLR service should be installed

nssm4

Start the newly created service

Using the net start command, let us start the solr service

cl1

Browser Test to see if  SOLR is running

Navigate to http://localhost:8983/solr/

browser
Command Line Test for SOLR Status

Navigate to the bin directory of your Solr directory and issue command : Solr Status

solr

How to install another solr instance on the same server

You will have to follow the below steps in order to set up another solr instance on the same server

  • Unzip the contents on the SOLR files on a new folder say “c:/solr/client2”
  • Run the same steps as outlined above (create a service, start the service and test the service)
  • Ensure when you are creating a new service to select a different port

I have attached a couple of screenshots outlined below

Installing solr service for client 2 (See the Path and Arguments)

solr2

Screenshot showing two solr instances running on different ports

solr3

You can also take a look into the local services to see the listed solr services there

services

I hope this posts helps you install solr seamlessly !!!

If case of questions/feedback, Please tweet me @sjain_hi