Conversion goal "Time On Page" can cause intermittent exception

Found in

EPiServer.Marketing.Testing 2.5.6

Fixed in

EPiServer.Marketing.Testing 2.5.7

Created

Feb 28, 2019

Updated

Mar 08, 2019

State

Closed, Fixed and tested


Description

Steps to reproduce:
1. Edit a page and create an A/B test.
2. Use "Time on page" conversion goal with settings 60 seconds, 50% participation percentage, and 30 days for instance.
3. Start the test.
4. Visit the page a couple of times if you can't see it the first time.

Expected:
Should show different versions of the page.

Actual:
Get exception when visiting one of the versions (either A or B):

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Marketing.Testing.Web.ClientKPI.ClientKpiInjector.AppendClientKpiScript() +605
   EPiServer.Marketing.Testing.Web.TestHandlerInitializer.onPostReleaseRequestState(Object sender, EventArgs e) +11
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71