Thursday, March 2, 2017

Exclude Robots functionality issues

As for now, there are three known issues related to the Exclude Robots functionality.

149102 - IP ranges in Exclude Robots don't support IPv6

This means that if you add an IPv4 range to the Sitecore.Analytics.ExcludeRobots.config file:

<excludedIPAddresses>
  127.0.0.1 - 128.0.0.1
</excludedIPAddresses>

and then visit a site with an IPv6 IP address, you will face the following exception:

[InvalidOperationException: rangeBegin.AddressFamily != address.AddressFamily]
   Sitecore.Web.IPAddresses.IPRange.Contains(IPAddress address) +262
   Sitecore.Web.IPAddresses.IPList.Contains(IPAddress address) +381
   Sitecore.Analytics.Configuration.ExcludeList.ContainsIpAddress(String addressString) +99
   Sitecore.Analytics.Pipelines.ExcludeRobots.CheckIpAddress.Process(ExcludeRobotsArgs args) +202
   (Object , Object[] ) +83
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
   Sitecore.Analytics.DefaultTracker.ExcludeRequest() +28
   Sitecore.Analytics.DefaultTracker.StartTracking() +267
   Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args) +95
   (Object , Object[] ) +83
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
  Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking.Process(RequestBeginArgs

The same behavior, if you specify an IPv6 range and then visit a site with a usual IPv4 address.

150102 - Sometimes IP ranges identify the occurrence of IP not correctly

There is a known issue in the method which should determine whether an IP address belongs to the IP range. For example, if you specify the 127.0.0.1 - 128.0.0.1 range, the 127.0.0.10 IP address will be considered as a not belonging one.

149113 (379609) - Exclude Robots does not take the Analytics.ForwardedRequestHttpHeader setting into account

There is a knowledge base article regarding this issue - https://kb.sitecore.net/articles/454115

FIX

The patch which fixes all the three issues can be found - https://github.com/SitecoreSupport/Sitecore.Support.149113.149102.150102

Monday, February 20, 2017

Unable to cast object of type 'System.String' to type 'Sitecore.Analytics.Reporting.ReportDataProvider'

Sitecore + WFFM

You can face the following exception:
Exception: System.InvalidCastException
Message: Unable to cast object of type 'System.String' to type 'Sitecore.Analytics.Reporting.ReportDataProviderBase'.
Source: Sitecore.Forms.Core
   at Sitecore.Forms.Core.Dependencies.DefaultImplFactoryObjectsProvider.CreateObject[T](String configPath, Boolean assert)
   at Sitecore.WFFM.Analytics.Dependencies.ReportDataProviderWrapper.GetReportDataProviderBase(Boolean assert)
   at Sitecore.WFFM.Analytics.Providers.AnalyticsFormsDataProvider..ctor(ReportDataProviderWrapper reportDataProviderWrapper, ILogger logger, IAnalyticsTracker analyticsTracker, ISettings settings)

If it's a CD + CM server, you should remove the highlighted node from the App_Config\Include\Z.SwitchMasterToWeb\SwitchMasterToWeb.config file:

<reporting>
  <dataProvider>
<datasources>
 <add key="item">
<FiltersFactory>
 <param desc="definitionDatabaseName">web</param>
</FiltersFactory>
 </add>
 <add key="collection">
<FiltersFactory>
 <param desc="definitionDatabaseName">web</param>
</FiltersFactory>
 </add>
 <add key="reporting">
<FiltersFactory>
 <param desc="definitionDatabaseName">web</param>
</FiltersFactory>
 </add>
</datasources>
  </dataProvider>
</reporting>

This is fixed in Sitecore 8.1 Update-1 (bug number - 96933).

If it's a CD server, please comment out the whole <reporting> node because it's trying to patch the Sitecore.Analytics.Reporting.config file which has to be disabled on a CD server.

Friday, February 3, 2017

The Analytics.ClusterName and Analytics.HostName settings


I will try to explain the purpose of each setting.

Very short

The Hostname setting is important only for multi-clustered environments. For the environments, which are not multi-clustered the setting is not important. But, there is a known issue with multi-site environments when the setting isn't empty. Therefore, you just need to keep the setting empty. It shouldn't be empty only in a multi-clustered environment with an only one site.

The Clustername setting is also used in multi-clustered environments (each cluster must have its own value of the setting). But, it's important for non-clustered environments too. It should be set to the domain name. This is related to both servers CM and CD. If it is empty, there is another known issue.

Details

The main purpose is scaling ability. The main idea of these settings is the following.
For example, you have 40 geographically distributed CD servers:

  • 10 in Australia;
  • 10 in Asia;
  • 10 in Europe;
  • 10 in the USA.

There is a sense to group them into 4 CD clusters. Each cluster will have its own session and shared session databases. But here we need a mechanism which will not allow a situation when the first request will be served by one cluster and the second request from the same user will be served by another cluster. Therefore, each of our clusters will have its own Analytics.Clustername setting, for example:

  • cluster1.site.com
  • cluster2.site.com
  • cluster3.site.com
  • cluster4.site.com

When the first visit of a visitor comes to cluster3.site.com, for example, this cluster will get (or create) a contact in the Mongo Analytics database and add the { "Lease.Owner.Identifier": "cluster3.site.com" } field to the contact. Which means that this cluster has locked this user. If the second request from the same client comes to another cluster, it will be redirected back to cluster3.site.com because this cluster serves the client and this cluster's session databases have the actual session data of the client. But even in a non-clustered environment, this setting is used to lock the contacts. Therefore, it's important to set it to the correct hostname on both CM and CD servers. Also, this host should be accessible from the CM.

Hostname setting, in this case, should be set to the main domain name - site.com which is under a load balancer. If the setting is not empty, Sitecore doesn't allow the first request in session to be made directly to a cluster. The first request is expected to be made to the host whose name is specified in Analytics.HostName setting which is under the load balancer that will redirect the first request to the most geographically appropriate cluster. But there is a known issue with multisite solutions since any site will be redirected to Hostname.

Monday, September 12, 2016

How to connect Sitecore 8.1 to Cloud 2.0


This guide works only for Cloud 2.0 since it is absolutely different from Cloud 1.0. 
All the provided in the article links are lead only to official Sitecore portals.

Here is an official Sitecore guide Connect to xDB Cloud 2.0. I will try to make it clearer.


1. Request a new Cloud set

First of all, you need to request creating a new Cloud 2.0 set for you. You can request it using Sitecore Support Portal.
Important note: you are not able to request a set for any Sitecore release. It works only for some releases and this could be changed anytime. This information is available here.
Support will provide you with the following connection strings:
  • analytics
  • tracking.live
  • tracking.history
  • tracking.contact
  • analytics.cloud.index
and with a Reporting Service configuration which looks like:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
   <httpTransportFactory patch:instead="httpTransportFactory" type="Sitecore.Cloud.Xdb.CloudBasedTransportFactory, Sitecore.Cloud.Xdb" singleInstance="true">
       <param desc="serviceUrl">URL</param>
       <param desc="certificateThumbprint">value</param>
   </httpTransportFactory>
</sitecore>
</configuration>


2. Configure Sitecore instance

You should properly configure your Sitecore instance. There are 3 possible Sitecore configurations:
  • Standalone Sitecore instance - when you have only one server which performs both of content management and content delivery roles. It is a default configuration out of the box. 
  • Content Management instance.
  • Content Delivery instance.

Standalone Sitecore instance

You need to have an out of the box configuration and then disable the following 11 files:
  1. /App_Config/Include/Sitecore.Analytics.Processing.Aggregation.Services.config
  2. /App_Config/Include/Sitecore.Analytics.Processing.Services.config
  3. /App_Config/Include/Sitecore.Analytics.Tracking.Database.ScaledCM.config (already disabled by default, just check)
  4. /App_Config/Include/Sitecore.MarketingProcessingRole.config (already disabled by default, just check)
  5. /App_Config/Include/Sitecore.PathAnalyzer.Processing.config
  6. /App_Config/Include/CES/Sitecore.CES.DeviceDetection.CheckInitialization.config (already disabled by default, just check)
  7. /App_Config/Include/ContentTesting/Sitecore.ContentTesting.Processing.Aggregation.config
  8. /App_Config/Include/ExperienceAnalytics/Sitecore.ExperienceAnalytics.Aggregation.config
  9. /App_Config/Include/ExperienceAnalytics/Sitecore.ExperienceAnalytics.ReAggregation.config (already disabled by default, just check)
  10. /App_Config/Include/ExperienceAnalytics/Sitecore.ExperienceAnalytics.StorageProviders.config
  11. /App_Config/Include/ExperienceAnalytics/Sitecore.ExperienceAnalytics.Reduce.config (important note: there is a documentation issue in the official guide - this file is also should be disabled)
The next important step is to enable a remote, dedicated Reporting Service server. If you experience any issues with Analytic reports, first of all, check these steps:
  1. enable the /App_Config/Include/Sitecore.Xdb.Remote.Client.config file
  2. disable /App_Config/Include/Sitecore.Xdb.Remote.Server.config (already disabled by default, just check)
  3. enable /App_Config/Include/Sitecore.PathAnalyzer.RemoteClient.config
  4. disable /App_Config/Include/Sitecore.PathAnalyzer.Services.RemoteServer.config (already disabled by default, just check)

Content Management instance

You should configure the server according to the official guide - Configure a content management server. A few notes:
  • Skip the Step 3: Configure database connection strings
  • Enable but don't change the Sitecore.Xdb.Remote.Client.config file
  • The guide contains a link to xDB Cloud configuration - skip it since it is related only to Cloud 1.0
  • if earlier your CM was configured like CM + Processing or CM + Processing or CM + Reporting + Processing, you need to reconfigure it again according to the Excel file from the guide. If you use Cloud, your Reporting and Processing servers will be at Sitecore end

Content Delivery instance

You should configure the server according to the official guide - Configure a content delivery server. A few notes:
  • The guide contains a link to xDB Cloud configuration - skip it since it is related only to Cloud 1.0
  • Skip the Step 4: Configure database connection strings


3. Cloud client upgrading

You must update the Cloud client to connect to Cloud 2.0 since it was released after Sitecore 8.1 Update-3. Here are your steps to do this:
  1. Download the Cloud client 2.0 here.
  2. Remove all the content of the \App_Config\Include\XdbCloud folder
  3. Install the downloaded package (Control Panel => Install a package). Choose to override all files.


4. Cloud Client configuration

  1. Copy the 5 provided by Support connection strings into the ConnectionStrings.config file: analytics, tracking.live, tracking.history, tracking.contact, analytics.cloud.index
  2. Remove the reporting connection string
  3. Open the \App_Config\Include\XdbCloud folder and enable 3 configuration files: Sitecore.Cloud.Xdb.config, Sitecore.ContentSearch.Cloud.DefaultIndexConfiguration.config, Sitecore.ContentSearch.Cloud.Index.Analytics.config
  4. Open the Sitecore.Cloud.Xdb.config one, remove its content and paste the  Reporting Service configuration which was provided by Sitecore Support or copy the serviceUrl and certificateThumbprint parameters.
Important note: it is correct that the new updated Sitecore.Cloud.Xdb.config file is smaller than the old one from Cloud 1.0.